package
In-memory file-system with Node's fs API.
npm install memfsGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
In-memory file system with Node.js fs API and browser File System (Access) API.
memfs is a JavaScript library that implements an in-memory file system compatible with Node.js fs module and the browser File System (Access) API. Use it for testing, mocking file systems, or creating virtual file systems in both Node.js and browser environments.
npm install memfsfs APIimport { fs } from 'memfs';
// Write a file
fs.writeFileSync('/hello.txt', 'Hello, World!');
// Read a file
const content = fs.readFileSync('/hello.txt', 'utf-8');
console.log(content); // "Hello, World!"
// Create a directory
fs.mkdirSync('/mydir');
// List directory contents
console.log(fs.readdirSync('/')); // ['hello.txt', 'mydir']import { fsa } from 'memfs';
// Get root directory handle
const root = await fsa.getRoot();
// Create a file
const file = await root.getFileHandle('hello.txt', { create: true });
const writable = await file.createWritable();
await writable.write('Hello, World!');
await writable.close();
// Read the file
const readable = await file.getFile();
const text = await readable.text
fs module API compatibilityfs and File System APIFor detailed documentation and more examples, visit the main project page.
Apache 2.0
Estimated unpacked size across 21 packages.
4.4 MB
Includes dependencies.
^2.5.0
2.6.1
^1.0.3
1.1.0
^1.3.1
1.3.1
^1.9.0
18.30.0
4.80.1
4.80.1
4.80.1
4.80.1
4.80.1
4.80.1
4.80.1
4.80.1
^1.11.0
18.30.0
4.80.1
4.80.1
4.80.1
4.80.1
4.80.1