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

@b9g/filesystem-s3

v0.2.0

Published

AWS S3 implementation of File System Access API

Readme

@b9g/filesystem-s3

AWS S3 implementation of the File System Access API. Provides standards-compliant file system operations backed by Amazon S3 object storage.

Features

  • Full FileSystemDirectoryHandle and FileSystemFileHandle implementation
  • Streaming writes via WritableStream
  • Directory simulation using S3 key prefixes
  • MIME type detection via the mime package
  • Compatible with @b9g/filesystem registry for pluggable backends
  • Requires @aws-sdk/client-s3 v3 as a peer dependency

Installation

npm install @b9g/filesystem-s3 @aws-sdk/client-s3

Usage

Direct Usage

import {S3Client} from "@aws-sdk/client-s3";
import {S3FileSystemDirectoryHandle} from "@b9g/filesystem-s3";

const s3 = new S3Client({region: "us-east-1"});
const root = new S3FileSystemDirectoryHandle(s3, "my-bucket", "");

// Read a file
const fileHandle = await root.getFileHandle("config.json");
const file = await fileHandle.getFile();
const text = await file.text();

// Write a file
const writable = await fileHandle.createWritable();
await writable.write(JSON.stringify({updated: true}));
await writable.close();

// Create a directory
const dir = await root.getDirectoryHandle("uploads", {create: true});

// List entries
for await (const [name, handle] of root.entries()) {
  console.log(name, handle.kind); // "file" or "directory"
}

// Delete (recursive for directories)
await root.removeEntry("uploads", {recursive: true});

With Shovel Filesystem Registry

import {S3FileSystemAdapter} from "@b9g/filesystem-s3";

// In shovel.json directories config:
// { module: "@b9g/filesystem-s3", export: "S3FileSystemAdapter" }

The S3FileSystemAdapter integrates with Shovel's directory system. Each named directory gets an isolated prefix (filesystems/{name}) within the bucket.

Exports

  • S3FileSystemDirectoryHandle -- FileSystemDirectoryHandle backed by S3 key prefixes
  • S3FileSystemFileHandle -- FileSystemFileHandle backed by S3 objects
  • S3FileSystemWritableFileStream -- WritableStream that buffers chunks and uploads on close
  • S3FileSystemAdapter -- Backend adapter for @b9g/filesystem registry

API

new S3FileSystemDirectoryHandle(s3Client, bucket, prefix)

| Parameter | Type | Description | |-----------|------|-------------| | s3Client | S3Client | AWS SDK v3 S3 client | | bucket | string | S3 bucket name | | prefix | string | Key prefix (e.g. "uploads/" or "" for root) |

Standard FileSystemDirectoryHandle methods: getFileHandle(), getDirectoryHandle(), removeEntry(), entries(), keys(), values(), isSameEntry().

new S3FileSystemFileHandle(s3Client, bucket, key)

| Parameter | Type | Description | |-----------|------|-------------| | s3Client | S3Client | AWS SDK v3 S3 client | | bucket | string | S3 bucket name | | key | string | Full S3 object key |

Standard FileSystemFileHandle methods: getFile(), createWritable(), isSameEntry().

new S3FileSystemAdapter(s3Client, bucket, config?)

| Parameter | Type | Description | |-----------|------|-------------| | s3Client | S3Client | AWS SDK v3 S3 client | | bucket | string | S3 bucket name | | config | FileSystemConfig? | Optional filesystem config |

Methods: getFileSystemRoot(name?), getConfig(), dispose().

Implementation Notes

  • Directories are simulated -- S3 has no native directories. Subdirectories use key prefixes, and getDirectoryHandle({create: true}) creates a .shovel_directory_marker object.
  • Writes are buffered -- createWritable() accumulates all chunks in memory and uploads in a single PutObjectCommand on close().
  • Permissions always granted -- S3 access is controlled by AWS credentials, so queryPermission() / requestPermission() always return "granted".
  • resolve() not implemented -- Returns null (not meaningful for flat S3 key spaces).

License

MIT