🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@jsonjoy.com/fs-node

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsonjoy.com/fs-node

In-memory filesystem with Node.js fs-compatible API

latest
Source
npmnpm
Version
4.68.0
Version published
Weekly downloads
8M
-18.61%
Maintainers
2
Weekly downloads
 
Created
Source

@jsonjoy.com/fs-node

In-memory filesystem with Node.js fs-compatible API.

Installation

npm install @jsonjoy.com/fs-node

Usage

import { Volume } from '@jsonjoy.com/fs-node';

const vol = new Volume();
vol.writeFileSync('/hello.txt', 'Hello, World!');
console.log(vol.readFileSync('/hello.txt', 'utf8')); // Hello, World!

Create filesystem from JSON

import { Volume } from '@jsonjoy.com/fs-node';

const vol = Volume.fromJSON({
  '/app/index.js': 'console.log("Hello");',
  '/app/package.json': '{"name": "app"}',
});

console.log(vol.readdirSync('/app')); // ['index.js', 'package.json']

API

The Volume class implements Node.js fs module's synchronous and callback APIs:

  • readFile, readFileSync
  • writeFile, writeFileSync
  • mkdir, mkdirSync
  • readdir, readdirSync
  • stat, statSync
  • unlink, unlinkSync
  • ... and many more

It also exposes a promises property for the Promise-based API:

const data = await vol.promises.readFile('/hello.txt', 'utf8');

License

Apache-2.0

Keywords

fs

FAQs

Package last updated on 05 Aug 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts