User-land implementation of the Node.js Virtual File System (VFS) based on nodejs/node#61478.
npm install node-vfs-polyfillRequires Node.js >= 22.0.0
const { VirtualFS } = require('node-vfs-polyfill');
const vfs = new VirtualFS();
vfs.mkdirSync('/app');
vfs.writeFileSync('/app/index.js', 'console.log("hello")');
vfs.mount('/vfs');
// After mounting, use standard fs module
const fs = require('fs');
fs.readFileSync('/vfs/app/index.js'); // works- In-memory file system with full fs API support
- Overlay mode for layering virtual files over real filesystem
- File descriptors, streams, and watch support
- Promise-based API via
fs.promises - Symlinks and glob patterns
node-vfs-polyfill- Main VirtualFS classnode-vfs-polyfill/provider- Base provider interfacenode-vfs-polyfill/memory-provider- In-memory storage provider
ISC
Code in vendor/vfs-upstream/ is from Node.js and subject to the Node.js license.