Skip to content

Virtual File System for Node.js#61478

Open
mcollina wants to merge 115 commits intonodejs:mainfrom
mcollina:vfs
Open

Virtual File System for Node.js#61478
mcollina wants to merge 115 commits intonodejs:mainfrom
mcollina:vfs

Conversation

@mcollina
Copy link
Member

@mcollina mcollina commented Jan 22, 2026

A first-class virtual file system module (node:vfs) with a provider-based architecture that integrates with Node.js's fs module and module loader.

Key Features

  • Provider Architecture - Extensible design with pluggable providers:

    • MemoryProvider - In-memory file system with full read/write support
    • SEAProvider - Read-only access to Single Executable Application assets
    • VirtualProvider - Base class for creating custom providers
  • Standard fs API - Uses familiar writeFileSync, readFileSync, mkdirSync instead of custom methods

  • Mount Mode - VFS mounts at a specific path prefix (e.g., /virtual), clear separation from real filesystem

  • Module Loading - require() and import work seamlessly from virtual files

  • SEA Integration - Assets automatically mounted at /sea when running as a Single Executable Application

  • Full fs Support - readFile, stat, readdir, exists, streams, promises, glob, symlinks

Example

const vfs = require('node:vfs');
const fs = require('node:fs');

// Create a VFS with default MemoryProvider
const myVfs = vfs.create();

// Use standard fs-like API
myVfs.mkdirSync('/app');
myVfs.writeFileSync('/app/config.json', '{"debug": true}');
myVfs.writeFileSync('/app/module.js', 'module.exports = "hello"');

// Mount to make accessible via fs module
myVfs.mount('/virtual');

// Works with standard fs APIs
const config = JSON.parse(fs.readFileSync('/virtual/app/config.json', 'utf8'));
const mod = require('/virtual/app/module.js');

// Cleanup
myVfs.unmount();

SEA Usage

When running as a Single Executable Application, bundled assets are automatically available:

const fs = require('node:fs');

// Assets are automatically mounted at /sea - no setup required
const config = fs.readFileSync('/sea/config.json', 'utf8');
const template = fs.readFileSync('/sea/templates/index.html', 'utf8');

Public API

const vfs = require('node:vfs');

vfs.create([provider][, options])  // Create a VirtualFileSystem
vfs.VirtualFileSystem              // The main VFS class
vfs.VirtualProvider                // Base class for custom providers
vfs.MemoryProvider                 // In-memory provider
vfs.SEAProvider                    // SEA assets provider (read-only)

Disclaimer: I've used a significant amount of Claude Code tokens to create this PR. I've reviewed all changes myself.


Fixes #60021

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/single-executable
  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jan 22, 2026
@avivkeller avivkeller added fs Issues and PRs related to the fs subsystem / file system. module Issues and PRs related to the module subsystem. semver-minor PRs that contain new features and should be released in the next minor version. notable-change PRs with changes that should be highlighted in changelogs. needs-benchmark-ci PR that need a benchmark CI run. test_runner Issues and PRs related to the test runner subsystem. labels Jan 22, 2026
@github-actions
Copy link
Contributor

The notable-change PRs with changes that should be highlighted in changelogs. label has been added by @avivkeller.

Please suggest a text for the release notes if you'd like to include a more detailed summary, then proceed to update the PR description with the text or a link to the notable change suggested text comment. Otherwise, the commit will be placed in the Other Notable Changes section.

@Ethan-Arrowood
Copy link
Contributor

Nice! This is a great addition. Since it's such a large PR, this will take me some time to review. Will try to tackle it over the next week.

*/
existsSync(path) {
// Prepend prefix to path for VFS lookup
const fullPath = this.#prefix + (StringPrototypeStartsWith(path, '/') ? path : '/' + path);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use path.join?

validateObject(files, 'options.files');
}

const { VirtualFileSystem } = require('internal/vfs/virtual_fs');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we import this at the top level / lazy load it at the top level?

ArrayPrototypePush(this.#mocks, {
__proto__: null,
ctx,
restore: restoreFS,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
restore: restoreFS,
restore: ctx.restore,

nit

* @param {object} [options] Optional configuration
*/
addFile(name, content, options) {
const path = this._directory.path + '/' + name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use path.join?

let entry = current.getEntry(segment);
if (!entry) {
// Auto-create parent directory
const dirPath = '/' + segments.slice(0, i + 1).join('/');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use path.join

let entry = current.getEntry(segment);
if (!entry) {
// Auto-create parent directory
const parentPath = '/' + segments.slice(0, i + 1).join('/');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path.join?

}
}
callback(null, content);
}).catch((err) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}).catch((err) => {
}, (err) => {

Comment on lines +676 to +677
const bytesToRead = Math.min(length, available);
content.copy(buffer, offset, readPos, readPos + bytesToRead);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Primordials?

}

callback(null, bytesToRead, buffer);
}).catch((err) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}).catch((err) => {
}, (err) => {

@avivkeller
Copy link
Member

Left an initial review, but like @Ethan-Arrowood said, it'll take time for a more in depth look

@joyeecheung
Copy link
Member

joyeecheung commented Jan 22, 2026

It's nice to see some momentum in this area, though from a first glance it seems the design has largely overlooked the feedback from real world use cases collected 4 years ago: https://github.com/nodejs/single-executable/blob/main/docs/virtual-file-system-requirements.md - I think it's worth checking that the API satisfies the constraints that users of this feature have provided, to not waste the work that have been done by prior contributors to gather them, or having to reinvent it later (possibly in a breaking manner) to satisfy these requirements from real world use cases.

@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

❌ Patch coverage is 92.89204% with 611 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.79%. Comparing base (e0928d6) to head (8728a45).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/vfs/setup.js 83.25% 255 Missing ⚠️
lib/internal/vfs/providers/memory.js 88.63% 91 Missing ⚠️
lib/internal/vfs/providers/real.js 85.26% 56 Missing ⚠️
lib/internal/vfs/file_system.js 96.58% 46 Missing ⚠️
lib/internal/vfs/watcher.js 92.83% 35 Missing and 3 partials ⚠️
lib/internal/vfs/streams.js 89.17% 29 Missing ⚠️
lib/internal/fs/cp/cp-sync.js 56.52% 20 Missing ⚠️
src/node_sea.cc 64.28% 12 Missing and 8 partials ⚠️
lib/internal/vfs/provider.js 97.17% 12 Missing and 4 partials ⚠️
lib/internal/vfs/stats.js 93.84% 12 Missing ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61478      +/-   ##
==========================================
+ Coverage   89.68%   89.79%   +0.10%     
==========================================
  Files         676      692      +16     
  Lines      206555   215088    +8533     
  Branches    39552    41196    +1644     
==========================================
+ Hits       185249   193138    +7889     
- Misses      13444    14045     +601     
- Partials     7862     7905      +43     
Files with missing lines Coverage Δ
lib/fs.js 98.53% <100.00%> (+0.34%) ⬆️
lib/internal/bootstrap/realm.js 96.21% <100.00%> (+<0.01%) ⬆️
lib/internal/fs/utils.js 99.68% <100.00%> (+<0.01%) ⬆️
lib/internal/modules/cjs/loader.js 98.20% <100.00%> (+0.05%) ⬆️
lib/internal/modules/esm/get_format.js 94.83% <100.00%> (ø)
lib/internal/modules/esm/load.js 91.47% <100.00%> (ø)
lib/internal/modules/esm/resolve.js 99.03% <100.00%> (-0.01%) ⬇️
lib/internal/modules/esm/translators.js 97.66% <100.00%> (ø)
lib/internal/modules/helpers.js 98.73% <100.00%> (+0.01%) ⬆️
lib/internal/modules/package_json_reader.js 99.72% <100.00%> (+<0.01%) ⬆️
... and 26 more

... and 33 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jimmywarting
Copy link

jimmywarting commented Jan 22, 2026

And why not something like OPFS aka whatwg/fs?

const rootHandle = await navigator.storage.getDirectory()
await rootHandle.getFileHandle('config.json', { create: true })
fs.mount('/app', rootHandle) // to make it work with fs
fs.readFileSync('/app/config.json')

OR

const rootHandle = await navigator.storage.getDirectory()
await rootHandle.getFileHandle('config.json', { create: true })

fs.readFileSync('sandbox:/config.json')

fs.createVirtual seems like something like a competing specification

@mcollina mcollina force-pushed the vfs branch 3 times, most recently from 5e317de to 977cc3d Compare January 23, 2026 08:15
@mcollina
Copy link
Member Author

And why not something like OPFS aka whatwg/fs?

I generally prefer not to interleave with WHATWG specs as much as possible for core functionality (e.g., SEA). In my experience, they tend to perform poorly on our codebase and remove a few degrees of flexibility. (I also don't find much fun in working on them, and I'm way less interested in contributing to that.)

On an implementation side, the core functionality of this feature will be identical (technically, it's missing writes that OPFS supports), as we would need to impact all our internal fs methods anyway.

If this lands, we can certainly iterate on a WHATWG-compatible API for this, but I would not add this to this PR.

@juliangruber
Copy link
Member

Small prior art: https://github.com/juliangruber/subfs

@mcollina mcollina force-pushed the vfs branch 2 times, most recently from 8d711c1 to 73c18cd Compare January 23, 2026 13:19
@Qard
Copy link
Member

Qard commented Jan 23, 2026

I also worked on this a bit on the side recently: Qard@73b8fc6

That is very much in chaotic ideation stage with a bunch of LLM assistance to try some different ideas, but the broader concept I was aiming for was to have a VirtualFileSystem type which would actually implement the entire API surface of the fs module, accepting a Provider type to delegate the internals of the whole cluster of file system types to a singular class managing the entire cluster of fs-related types such that the fs module could actually just be fully converted to:

module.exports = new VirtualFileSystem(new LocalProvider())

I intended for it to be extensible for a bunch of different interesting scenarios, so there's also an S3 provider and a zip file provider there, mainly just to validate that the model can be applied to other varieties of storage systems effectively.

Keep in mind, like I said, the current state is very much just ideation in a branch I pushed up just now to share, but I think there are concepts for extensibility in there that we could consider to enable a whole ecosystem of flexible storage providers. 🙂

Personally, I would hope for something which could provide both read and write access through an abstraction with swappable backends of some variety, this way we could pass around these virtualized file systems like objects and let an ecosystem grow around accepting any generalized virtual file system for its storage backing. I think it'd be very nice for a lot of use cases like file uploads or archive management to be able to just treat them like any other readable and writable file system.

@jimmywarting
Copy link

jimmywarting commented Jan 23, 2026

Personally, I would hope for something which could provide both read and write access through an abstraction with swappable backends of some variety, this way we could pass around these virtualized file systems like objects and let an ecosystem grow around accepting any generalized virtual file system for its storage backing. I think it'd be very nice for a lot of use cases like file uploads or archive management to be able to just treat them like any other readable and writable file system.

just a bit off topic... but this reminds me of why i created this feature request:
Blob.from() for creating virtual Blobs with custom backing storage

Would not lie, it would be cool if NodeJS also provided some type of static Blob.from function to create virtual lazy blobs. could live on fs.blobFrom for now...

example that would only work in NodeJS (based on how it works internally)

const size = 26

const blobPart = BlobFrom({
  size,
  stream (start, end) {
    // can either be sync or async (that resolves to a ReadableStream)
    // return new Response('abcdefghijklmnopqrstuvwxyz'.slice(start, end)).body
    // return new Blob(['abcdefghijklmnopqrstuvwxyz'.slice(start, end)]).stream()
    
    return fetch('https://httpbin.dev/range/' + size, {
      headers: {
        range: `bytes=${start}-${end - 1}`
      }
    }).then(r => r.body)
  }
})

blobPart.text().then(text => {
  console.log('a-z', text)
})

blobPart.slice(-3).text().then(text => {
  console.log('x-z', text)
})

const a = blobPart.slice(0, 6)
a.text().then(text => {
  console.log('a-f', text)
})

const b = a.slice(2, 4)
b.text().then(text => {
  console.log('c-d', text)
})
x-z xyz
a-z abcdefghijklmnopqrstuvwxyz
a-f abcdef
c-d cd

An actual working PoC

(I would not rely on this unless it became officially supported by nodejs core - this is a hack)

const blob = new Blob()
const symbols = Object.getOwnPropertySymbols(blob)
const blobSymbol = symbols.map(s => [s.description, s])
const symbolMap = Object.fromEntries(blobSymbol)
const {
  kHandle,
  kLength,
} = symbolMap

function BlobFrom ({ size, stream }) {
  const blob = new Blob()
  if (size === 0) return blob

  blob[kLength] = size
  blob[kHandle] = {
    span: [0, size],

    getReader () {
      const [start, end] = this.span
      if (start === end) {
        return { pull: cb => cb(0) }
      }

      let reader

      return {
        async pull (cb) {
          reader ??= (await stream(start, end)).getReader()
          const {done, value} = await reader.read()
          cb(done ^ 1, value)
        }
      }
    },

    slice (start, end) {
      const [baseStart] = this.span

      return {
        span: [baseStart + start, baseStart + end],
        getReader: this.getReader,
        slice: this.slice,
      }
    }
  }

  return blob
}

currently problematic to do: new Blob([a, b]), new File([blobPart], 'alphabet.txt', { type: 'text/plain' })

also need to handle properly clone, serialize & deserialize, if this where to be sent of to another worker - then i would transfer a MessageChannel where the worker thread asks main frame to hand back a transferable ReadableStream when it needs to read something.

but there are probably better ways to handle this internally in core with piping data directly to and from different destinations without having to touch the js runtime? - if only getReader could return the reader directly instead of needing to read from the ReadableStream using js?

mcollina and others added 29 commits March 16, 2026 22:28
- Remove fd 10000 implementation detail from documentation
- Move virtualCwd Worker threads example to Worker threads section
- Use kEmptyObject, optional chaining, primordials in memory.js
- Simplify openSync try/catch and readdir iteration
- Use parentPath instead of recomputing in ensureParent
- Explain readFileSync wrapper purpose in helpers.js
- Revert opts→options JSDoc rename in package_json_reader.js
- Restore internalFsBinding to module level in package_json_reader.js
- Add POSIX separator comment in embedding.js
Reverts the change that converted isExperimentalSeaWarningNeeded from
a SetMethod (function) to a boolean property in the sea binding. This
keeps mksnapshot.js unchanged from upstream.
Revert changes to cjs/loader.js (extensionless file format detection)
and esm/resolve.js (refactoring, bug fix, circular dep changes) that
are not needed for VFS. Restore lazy loading of defaultResolve and
defaultLoadSync in esm/loader.js to avoid snapshot build failure since
the reverted resolve.js has top-level getOptionValue calls.
Restore cjs/loader.js extensionless file format detection and
test-extensionless-esm-type-commonjs test from upstream/main,
which were incorrectly reverted in the previous commit.
Move the internalModuleStat logic into VirtualFileSystem where it is
used internally, instead of exposing it on the VFSProvider base class.
The method now uses statSync directly rather than delegating to the
provider.
Restore all files under lib/internal/modules/ to match upstream/main
exactly. VFS module loading is fully handled by Module.registerHooks()
without any patches to the module loader internals.
Restore isSea as a C++ function (was incorrectly changed to a boolean
property), fixing cctest failures where helpers.js calls isSea().
Align all files under lib/internal/modules/ with upstream/main so
VFS introduces zero changes to the module loader internals.
sea.js was treating isSea as a boolean property, but the C++ binding
was restored to expose isSea as a function. This mismatch caused
getAssetKeys() to crash with a C++ assertion failure when called
outside a SEA, because the JS guard `if (!isSeaFlag)` never triggered
(a function reference is always truthy).

Restore sea.js from upstream/main to use isSea() as a function call.
Use wrapModuleLoad instead of custom embedderRunCjs code when VFS is
enabled. This gives proper CJS cycle handling and standard module
loading behavior through the registered VFS hooks.

- Restore embedderRunCjs to match upstream (no VFS-specific code)
- Restore embedderRequire to use loadBuiltinModuleForEmbedder
- Add VFS entry path in embedderRunEntryPoint using wrapModuleLoad
  with path.posix.join for cross-platform path construction
- Auto-include main script as VFS asset during blob generation so
  wrapModuleLoad can find it at the VFS mount point
- Expose mainCodePath from SEA binding to construct correct VFS path
Add loaderStat(), loaderReadFile(), and setLoaderFsOverrides() to
helpers.js, and modify toRealPath() to support a VFS toggle. Replace
direct internalFsBinding.internalModuleStat() and fs.readFileSync()
calls in the CJS loader, ESM resolver, ESM loader, translators, and
package_json_reader with these wrappers.

The VFS module_hooks.js now calls setLoaderFsOverrides() first in
installHooks(), making loader fs interception order-independent and
eliminating conflicts with cached fs method references.

Fix two pre-existing bugs in esm/resolve.js finalizeResolution():
- StringPrototypeEndsWith() was called with internalFsBinding as
  first arg instead of path
- StringPrototypeSlice(path, -1) returned the last char instead of
  stripping the trailing slash (now correctly uses path, 0, -1)

Existing fs patches for user-facing operations are kept unchanged.
- Remove redundant #getBaseName/#getParentPath from MemoryProvider,
  use pathPosix.basename/dirname directly
- Remove redundant getBaseName/getParentPath/splitPath from router.js,
  keep only functions with non-trivial VFS-specific logic
- Convert RealFSProvider constant getters (readonly, supportsSymlinks)
  to readonly properties via ObjectDefineProperty
- Fix joinVFSPath/normalizeVFSPath to detect Windows drive-letter paths
  by checking for ':' at position 1 instead of checking for leading '/',
  so bare '/' is always treated as a POSIX VFS path
- Update test-vfs-internals.js to match router.js export changes
Use path.resolve() instead of pathPosix.normalize() for VFS path
normalization so mount points resolve correctly on Windows (e.g.
/virtual -> C:\virtual). Use path.sep and path.relative() in router
for cross-platform mount point matching. Remove normalizeVFSPath and
joinVFSPath wrappers in favor of direct path utility calls. Update
tests to use path.resolve()/path.normalize() for platform-portable
assertions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove blank lines between JSDoc description and @param tags
(jsdoc/tag-lines) and remove unused `common` variable assignment
(no-unused-vars).
Wrap modulesBinding.readPackageJSON(), getNearestParentPackageJSON(),
getPackageScopeConfig(), and getPackageType() with toggleable overrides
so that VFS-mounted package.json files are read from virtual storage
instead of the real filesystem. This fixes syntax detection and error
decoration that re-read package.json bypassing VFS.

The implementation follows the existing loaderStat/loaderReadFile toggle
pattern in helpers.js.
Remove the vfs-mount/vfs-unmount events emitted on process, as they
are insufficient as a security control and a proper permission system
is needed instead.
Add tests covering require() of ESM modules from VFS with package.json
type detection (.js with type:module, nested directory walk-up, ESM-to-ESM
imports) and .mjs extension-based ESM loading without type:module.
Add SEA config validation to error when useVfs is enabled together with
useSnapshot, useCodeCache, or mainFormat: "module", as these combinations
are not supported.
Instead of monkey-patching fs.readFileSync, fs.statSync, etc. at
runtime in module_hooks.js, add VFS handler guards directly inside the
fs method bodies. This fixes the destructuring problem where capturing
a reference before vfs.mount() would bypass VFS:

  const { readFileSync } = require('fs');
  vfs.mount('/app');
  readFileSync('/app/file.txt'); // now works correctly

The approach:
- Add shared vfsState object and setVfsHandlers() in internal/fs/utils
- Add a null-check guard at the top of 9 sync methods in lib/fs.js
  and 3 async methods in lib/internal/fs/promises.js
- Replace installFsPatches() with a handler object registered via
  setVfsHandlers() — same logic, no monkey-patching
- Rename module_hooks.js to setup.js (no longer does monkey-patching)

When no VFS is active, the overhead is a single null comparison per
call. When the last VFS is unmounted, handlers are cleared to restore
the zero-overhead path.
Remove ~550 lines of duplicated module resolution functions that
reimplemented canonical Node.js resolver behavior (extension trying,
package exports resolution, bare specifier walking, directory entry
resolution, format detection). The canonical resolvers already consult
VFS through the loader overrides installed by installModuleLoaderOverrides(),
making the Module.registerHooks() resolve/load hooks redundant.

Also add clearStatCache() to the CJS loader, called on VFS unmount to
prevent stale stat cache entries from causing incorrect resolution after
a VFS is deregistered.
Previously only 9 sync methods in fs.js and 3 async methods in
promises.js were intercepted, causing callback-based and promise-based
operations on VFS paths to fall through to the real filesystem.

Add interception for ~40 fs methods across sync, callback, promise,
FD-based, and stream APIs. Add VirtualWriteStream, writeSync, rmSync,
and rm to the VFS class. Document all intercepted methods in vfs.md.
Add 14 new test blocks covering symlink ops, callback write ops,
FD write callbacks, string writeSync, ReadStream start/end options,
stream open events, VFS property getters, rmSync force, and
promises.rm recursive. Fix must-call-assert lint error in
test-vfs-destructuring.js.
Add VFS interceptions for truncate, ftruncate, link, mkdtemp, opendir,
openAsBlob, chmod, and utimes. Create VirtualDir class for opendir
support. Fix cp/cpSync to bypass C++ fast paths (cpSyncCopyDir,
cpSyncOverrideFile, cpSyncCheckPaths, internalModuleStat) when operating
on VFS paths, since C++ bindings cannot see virtual files. Add chmod and
utimes as no-ops for VFS paths since VFS does not track permissions or
timestamps. Add hard link support to MemoryProvider. Add comprehensive
tests for all new interceptions including cp and glob on VFS.
Intercept the remaining ~18 fs methods that still called C++ bindings
directly when operating on VFS paths/FDs:

Path-based no-ops (VFS doesn't track permissions/ownership/timestamps):
- chown/chownSync, lchown/lchownSync, lutimes/lutimesSync

FD-based no-ops (VFS FDs don't need sync/permissions/ownership):
- fchmod/fchmodSync, fchown/fchownSync, futimes/futimesSync,
  fdatasync/fdatasyncSync, fsync/fsyncSync

Real implementations:
- statfs/statfsSync (return synthetic StatFs for VFS mount)
- readv/readvSync (scatter read via readSync loop)
- writev/writevSync (gather write via writeSync loop)

Promise API:
- lchmod, lchown, chown, lutimes, statfs

Also moves the VFS check in promises.lchmod() before the O_SYMLINK
gate so it works on Linux where O_SYMLINK is undefined.
Convert isVfsEnabled from a boolean property set during Initialize()
to a SetMethod function, matching the isSea() pattern. This addresses
review feedback requesting consistency in the C++ binding API.
…xtensionlessFile

Both internalBinding('fs') methods bypass VFS fs-level overrides since
they use uv_fs_stat/read directly in C++. Route them through toggleable
wrappers in helpers.js so the VFS can handle paths under active mounts.
ESM legacyMainResolve is only triggered via bare specifier package
resolution, not directory path imports. Use VFS node_modules with
wrapper .mjs modules that re-export from bare specifiers to properly
exercise the VFS legacyMainResolve override.
Add comprehensive tests for URL arguments, throwIfNoEntry branches,
VirtualDir async methods, VirtualWriteStream error paths, Provider
base class, MemoryProvider edge cases, and VFS callback operations.
Add c8 ignore comments for SEA provider and SEA VFS initialization
code that requires actual SEA binary execution to test.
@boneskull
Copy link
Member

@mcollina This is caldissimo.

I'm curious if you see a way to build "snapshot" functionality onto this. For example, say I wanted to save a snapshot of a directory in my VFS to a CBOR file on disk, and parse and load it into a new VFS later. Doable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fs Issues and PRs related to the fs subsystem / file system. lib / src Issues and PRs related to general changes in the lib or src directory. module Issues and PRs related to the module subsystem. needs-benchmark-ci PR that need a benchmark CI run. needs-ci PRs that need a full CI run. notable-change PRs with changes that should be highlighted in changelogs. semver-minor PRs that contain new features and should be released in the next minor version. test_runner Issues and PRs related to the test runner subsystem. tsc-agenda Issues and PRs to discuss during the meetings of the TSC.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement VFS (Virtual File System) Hooks for Single Executable Applications