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

@skaldapp/fsa

v1.0.34

Published

A TypeScript library providing a File System Access API wrapper for web applications. Offers AWS S3-like operations (get, put, delete, head) to interact with local file systems efficiently in modern browsers.

Readme

@skaldapp/fsa

A TypeScript library that provides a wrapper around the File System Access API, enabling web applications to interact with the user's local file system in a structured way. The library mimics AWS S3-like operations (get, put, delete, head) for files and directories.

Table of Contents

Features

  • AWS S3-like API interface for local file system access
  • Get, put, delete, and head operations for files and directories
  • Promise-based asynchronous operations
  • Blob and text content handling
  • Recursive directory navigation
  • TypeScript support with comprehensive type definitions
  • AGPL-3.0 licensed

Installation

npm install @skaldapp/fsa

Supported Browsers

This library uses the File System Access API, which is currently supported in:

  • Google Chrome (v86+)
  • Microsoft Edge (v86+)
  • Opera (v72+)

Note: Support in other browsers may vary. Check caniuse.com for the most current browser compatibility.

API

The library provides the following functions:

deleteObject(Bucket, Key)

Deletes an object from the file system

  • Bucket - The root directory handle (FileSystemDirectoryHandle)
  • Key - The path to the object to delete (string)
  • Returns: Promise that resolves when the object is deleted

getObjectBlob(Bucket, Key)

Gets an object as a Blob from the file system

  • Bucket - The root directory handle (FileSystemDirectoryHandle)
  • Key - The path to the object (string)
  • Returns: Promise resolving to a Blob

getObjectText(Bucket, Key)

Gets an object as text from the file system

  • Bucket - The root directory handle (FileSystemDirectoryHandle)
  • Key - The path to the object (string)
  • Returns: Promise resolving to a string

headObject(Bucket, Key)

Checks if an object exists in the file system

  • Bucket - The root directory handle (FileSystemDirectoryHandle)
  • Key - The path to the object (string)
  • Returns: Promise that resolves to undefined if object exists, throws error if not

putObject(Bucket, Key, body)

Puts an object into the file system

  • Bucket - The root directory handle (FileSystemDirectoryHandle)
  • Key - The path to store the object at (string)
  • body - The content of the object (StreamingBlobPayloadInputTypes)
  • Returns: Promise that resolves when the object is stored

removeEmptyDirectories(directory, exclude)

Removes empty directories from the file system

  • directory - The directory to process (FileSystemDirectoryHandle)
  • exclude - Directories to exclude from removal (string[])
  • Returns: Promise that resolves when the operation is complete

Usage

First, you'll need to get a directory handle from the user using the File System Access API:

import { 
  putObject, 
  getObjectText, 
  deleteObject, 
  headObject, 
  getObjectBlob,
  removeEmptyDirectories
} from '@skaldapp/fsa';

// Get a directory handle from the user
const directoryHandle = await window.showDirectoryPicker();

// Example: Write content to a file
await putObject(directoryHandle, 'path/to/file.txt', 'Hello, world!');

// Example: Read file as text
const text = await getObjectText(directoryHandle, 'path/to/file.txt');
console.log(text); // Outputs: 'Hello, world!'

// Example: Read file as Blob
const blob = await getObjectBlob(directoryHandle, 'path/to/file.txt');
console.log(blob); // Outputs: Blob object

// Example: Check if a file exists
try {
  await headObject(directoryHandle, 'path/to/file.txt');
  console.log('File exists');
} catch (error) {
  console.log('File does not exist');
}

// Example: Delete a file
await deleteObject(directoryHandle, 'path/to/file.txt');



// Example: Remove empty directories (excluding specific ones)
await removeEmptyDirectories(directoryHandle, ['.git', 'node_modules']);

Examples

Working with nested directories

// Create and write to a file in nested directories
await putObject(directoryHandle, 'folder1/folder2/folder3/file.txt', 'Content');

// Read from nested path
const content = await getObjectText(directoryHandle, 'folder1/folder2/folder3/file.txt');

Reading files in different formats

// As text
const textContent = await getObjectText(directoryHandle, 'file.txt');

// As Blob
const blobContent = await getObjectBlob(directoryHandle, 'file.txt');

// Converting Blob to other formats
const arrayBuffer = await (await getObjectBlob(directoryHandle, 'file.bin')).arrayBuffer();
const dataUrl = await (await getObjectBlob(directoryHandle, 'image.png')).text(); // Use proper method for data URLs

Batch operations

// Perform multiple operations
const operations = Promise.all([
  putObject(directoryHandle, 'file1.txt', 'Content 1'),
  putObject(directoryHandle, 'file2.txt', 'Content 2'),
  putObject(directoryHandle, 'file3.txt', 'Content 3')
]);

await operations;

License

This project is licensed under the AGPL-3.0 License - see the LICENSE file for details.

The AGPL-3.0 license requires that if you modify this library and provide access to it over a network, you must also make the modified source code available under the same license.