vfs: dispatch fs/promises to mounted VFS instances#63537
Open
mcollina wants to merge 1 commit into
Open
Conversation
Add mount/unmount lifecycle on `VirtualFileSystem`, a handler registry that fs.js and fs/promises.js consult via `vfsState.handlers`, and a router that maps absolute paths to the VFS that owns them. When a VFS is mounted, the public `fs.*` and `fs/promises` APIs (including streams, `fs.watch`, and `opendir`) dispatch to the provider for paths under the mount point, and fall through to the real filesystem otherwise. Includes per-method dispatch tests, error-path coverage, multi-mount routing tests, and router unit tests. Ref: nodejs#63115 Signed-off-by: Matteo Collina <hello@matteocollina.com>
jasnell
approved these changes
May 24, 2026
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #63537 +/- ##
==========================================
+ Coverage 90.32% 90.35% +0.03%
==========================================
Files 730 732 +2
Lines 234209 235705 +1496
Branches 43934 44443 +509
==========================================
+ Hits 211558 212982 +1424
- Misses 14372 14452 +80
+ Partials 8279 8271 -8
🚀 New features to boost your workflow:
|
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
VirtualFileSystemplus a handler registry consulted bylib/fs.js,lib/internal/fs/promises.js, andlib/internal/fs/dir.jsviavfsState.handlers.fs.*andfs/promisesAPIs (sync, callback, promise, streams,fs.watch,opendir) dispatch to the mounted provider and fall through to the real filesystem otherwise.Ref: #63115