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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mad-c/file-system-helpers

v1.0.1

Published

Helpwer for working with the File System API

Readme

file-system-helpers

A collection of lightweight TypeScript helpers for the File System API. Designed to simplify working with both the user-facing File System Access API and the Origin Private File System (OPFS).

Features

  • OPFS Helpers: File and directory helper functions for common operations (read, save, copy, move, delete).
  • Path Utilities: node.js inspired path manipulation functions.
  • File System Access Helpers: Wrappers of showOpenFilePicker, showSaveFilePicker, and showDirectoryPicker with permission checking.
  • Persistence: Store and retrieve FileSystemHandle objects in IndexedDB to maintain access across browser sessions.
  • Permissions Management: Helpers to check and get permissions for files and directories.

Installation

npm install @mad-c/file-system-helpers

Usage

Origin Private File System (OPFS) Helpers

Resolve handles deeply within the OPFS structure.

import { getDirHandle, getFileHandle } from 'mad-file-system-helpers';

// Get a file handle, creating directories recursively and the file reference
const fileHandle = await getFileHandle('/path/to/my-file.txt', {
	touch: true,
	recursive: true
});

// Get a directory handle, creating directories recursively
const dirHandle = await getDirHandle('/projects/web/src', {
	recursive: true
});

Path Utilities

A set of path helpers inspired by node.js' path module but made to work directly with the browser and be easy to work with the OPFS.

[!NOTE] All functions will use a forward slash (/) as the path separator. Browsers normalize paths to use this convention even on Windows. The path manipulation API is simplified byt not handling backslashes (\)

import { basename, dirname, extname, resolve } from 'mad-file-system-helpers';

basename('/path/to/file.txt'); // 'file.txt'
dirname('/path/to/file.txt'); // '/path/to'
extname('/path/to/file.txt'); // '.txt'
resolve('folder', 'subfolder', 'file.js'); // '/folder/subfolder/file.js'

File System Access Helpers

[!WARNING] This API is supported only on Chromium based browsers.

Improve interactions with the user's local file system.

import { getUserOpenFileHandle, getUserSaveFileHandle } from 'mad-file-system-helpers';

// Show the user a file picker with automatic permission handling
const handle = await getUserOpenFileHandle({
	types: [{ description: 'Text files', accept: { 'text/plain': ['.txt'] } }]
}, 'readwrite');

if (handle) {
	// Work with the handle...
}

Persistence

Saves handles to IndexedDB allowing to access the handle again on a new browser session (page reload, new tab, etc.).

import { getHandle, saveHandle } from 'mad-file-system-helpers';

// Save a handle, with a defined id, and any metadata.
await saveHandle('id-for-the-handle', handle, metadata);

// On another day, a new browser session...
const saved = await getHandle('id-for-the-handle');
if (saved) {
	const { handle, metadata } = saved;

	// Use the handle...
}