Skip to content
ricsamPublic

About

Node Active FS - nafs. File system abstraction to read/write files to AWS S3 or local directory. Includes middleware for usage with express.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Node Active FS - nafs

Nafs is an abstraction of the Node fs API where you can choose to point the fs to a remote location like s3, postgres, logstash, kibana or locally like the local filesystem or in memory. Check the compatiblility table to see which parts of the fs API has been implemented for each backend.

npm install nafs

API docs
npm
Github

Enable cache for remote data

const remoteFs = nafs('s3://key:secret@us-east-1/bucket_name');
const localFs = nafs('/tmp/some_folder');

await remoteFs.promises.writeFile('/hello', 'Hello World');
await remoteFs.promises.readFile('/hello', 'utf8'); // Hello World

await localFs.promises.writeFile('/hello', 'Hello World');
await localFs.promises.readFile('/hello', 'utf8'); // Hello World

Supported File System Methods

Method File System Memory Amazon S3 Enstore Google Cloud Storage Azure Storage
promises.readFile ✅ ✅ ✅ ✅ ❌ ❌
promises.writeFile ✅ ✅ ✅ ✅ ❌ ❌
promises.unlink ✅ ✅ ❌ ❌ ❌ ❌
promises.rmdir ✅ ✅ ❌ ❌ ❌ ❌
promises.mkdir ✅ ✅ ❌ ❌ ❌ ❌
promises.readdir ✅ ✅ ❌ ❌ ❌ ❌
promises.stat ✅ ✅ ❌ ❌ ❌ ❌
promises.lstat ✅ ✅ ❌ ❌ ❌ ❌
promises.chmod ✅ ✅ ❌ ❌ ❌ ❌
promises.chown ✅ ✅ ❌ ❌ ❌ ❌
promises.utimes ✅ ✅ ❌ ❌ ❌ ❌
promises.rename ✅ ✅ ❌ ❌ ❌ ❌
promises.copyFile ✅ ✅ ❌ ❌ ❌ ❌
promises.symlink ✅ ✅ ❌ ❌ ❌ ❌
promises.readlink ✅ ✅ ❌ ❌ ❌ ❌
promises.truncate ✅ ✅ ❌ ❌ ❌ ❌
promises.access ✅ ✅ ❌ ❌ ❌ ❌
createReadStream ✅ ✅ ✅ ✅ ❌ ❌
createWriteStream ✅ ✅ ✅ ✅ ❌ ❌

✅ - Implemented
❌ - Not Implemented

File System and Memory implementations are provided via memfs and linkfs, supporting full Node.js fs API compatibility. Cloud storage implementations (Amazon S3, Google Cloud Storage, Azure Storage) are under development, with S3 currently supporting basic file reading and writing operations.

Documentation development

The Mintlify documentation source is in docs/. Install the Mintlify CLI, then preview or validate the site from the repository root:

npm run docs
npm run docs:check

When configuring this repository in Mintlify, set the documentation path to docs.

About

Node Active FS - nafs. File system abstraction to read/write files to AWS S3 or local directory. Includes middleware for usage with express.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages