npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

seczure.ts

v1.0.5

Published

Node.js native integration TypeScript library for sf-api

Readme

Seczure.ts

A Node.js native integration TypeScript library for sf-api secure filesystem operations.

Overview

Seczure.ts provides a TypeScript interface to the sf-api C library, enabling secure filesystem operations through a native Node.js addon. The library includes the FsShellLib class which bridges the extern C functions from sf-api.h.

Features

  • Native Performance: Direct integration with sf-api C library
  • TypeScript Support: Full type definitions and IntelliSense support
  • Comprehensive API: Covers disk operations, file operations, and filesystem management
  • Error Handling: Proper error codes and exception handling
  • Memory Management: Safe buffer operations and memory cleanup

Installation

pnpm install
pnpm run build

Prerequisites

  • Node.js >= 16.0.0
  • Python (for node-gyp)
  • C++ compiler (GCC, Clang, or MSVC)
  • sf-api library installed on your system

Usage

Basic Example

import { FsShellLib } from 'seczure.ts';

const fsShell = new FsShellLib();

// Get library version
const version = fsShell.getVersion();
console.log('SF Library Version:', version);

// Get available drives
const driveInfo = fsShell.diskGetDrives(1024);
if (FsShellLib.isSuccess(driveInfo.result)) {
    const drives = FsShellLib.parseDriveList(driveInfo.drives);
    console.log('Available drives:', drives);
}

// Open a disk
const openResult = fsShell.diskOpen('D:', 'password123');
if (FsShellLib.isSuccess(openResult)) {
    console.log('Disk opened successfully');
    
    // Perform file operations...
    
    // Close the disk
    fsShell.diskClose();
}

File Operations

// Create a new file
const fd = fsShell.create('/path/to/file.txt');
if (fd >= 0) {
    // Write data
    const data = Buffer.from('Hello, World!', 'utf8');
    const bytesWritten = fsShell.write(fd, data);
    
    // Read data
    const readResult = fsShell.read(fd, 1024);
    console.log('Read data:', readResult.buffer.toString('utf8'));
    
    // Close file
    fsShell.close(fd);
}

Directory Operations

// Get file list
const fileListResult = fsShell.getFileList('/path/to/directory');
if (FsShellLib.isSuccess(fileListResult.result)) {
    const files = FsShellLib.parseFileList(fileListResult.fileList);
    console.log('Files:', files);
}

API Reference

FsShellLib Class

Version and Test Methods

  • getVersion(): string - Get SF library version
  • test(): string - Test SF library functionality
  • getLastError(): number - Get last error code

Disk Operations

  • diskSetDriverMode(mode: number): number - Set disk driver mode
  • diskGetCount(): number - Get number of available disks
  • diskGetDrives(bufferLength?: number): DriveInfo - Get available drives
  • diskOpen(drive: string, password: string): number - Open disk with password
  • diskClose(): number - Close currently opened disk

File Operations

  • create(filename: string): number - Create new file
  • open(filename: string): number - Open file for read/write
  • close(fd: number): number - Close file
  • read(fd: number, length: number): ReadResult - Read from file
  • write(fd: number, buffer: Buffer): number - Write to file

Directory Operations

  • getFileList(path: string): FileListResult - Get directory file list

Utility Methods

  • static isSuccess(result: number): boolean - Check if result indicates success
  • static parseDriveList(driveString: string): string[] - Parse drive list string
  • static parseFileList(fileListString: string): string[] - Parse file list string

Building

Build Native Addon

pnpm run build:native

Build TypeScript

pnpm run build:ts

Build All

pnpm run build

Clean Build

pnpm run clean

Testing

pnpm test

Error Handling

All SF functions return integer error codes where 0 indicates success. Use FsShellLib.isSuccess(result) to check for successful operations.

const result = fsShell.diskOpen('D:', 'password');
if (!FsShellLib.isSuccess(result)) {
    const errorCode = fsShell.getLastError();
    console.error('Failed to open disk, error code:', errorCode);
}

License

MIT

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request