Skip to content

vfs: add --vfs-mount startup flag - #7

Draft
pipobscure wants to merge 1 commit into
zipvfsproviderfrom
vfsmount
Draft

vfs: add --vfs-mount startup flag#7
pipobscure wants to merge 1 commit into
zipvfsproviderfrom
vfsmount

Conversation

@pipobscure

@pipobscure pipobscure commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Adds --vfs-mount=<source>[=<target>], which mounts a directory or archive file as a virtual file system (node:vfs) at , or at 's own resolved path when no is given. The running program's own node:fs calls to paths under a mount resolve against it, while every other path uses the real file system unchanged. The flag may be repeated to mount several sources, gated by --experimental-vfs.

Provider selection is pluggable and content-based, never by file extension. vfs.registerProvider() lets a module - typically preloaded with -r - register a provider for a directory or archive format; registered providers are tried first (newest wins, for directories as well as files), so a custom provider can back, wrap, or vet any mount. If none claims a source, the built-ins handle it: a directory with RealFSProvider, and a file whose bytes are a ZIP archive with the read-only ZipProvider. A ZIP is recognized by locating its end-of-central-directory record - so an archive can carry any name and even a prefix; a .zip name is accepted without reading, as a fast path. A source no provider claims fails with ERR_VFS_INVALID_TARGET.

Workers inherit the parent's --vfs-mount targets unless they supply their own execArgv with a --vfs-mount of their own.

Adds --vfs-mount=<source>[=<target>], which mounts a directory or
archive file as a virtual file system (node:vfs) at <target>, or at
<source>'s own resolved path when no <target> is given. The running
program's own node:fs calls to paths under a mount resolve against it,
while every other path uses the real file system unchanged. The flag
may be repeated to mount several sources, gated by --experimental-vfs.

Provider selection is pluggable and content-based, never by file
extension. vfs.registerProvider() lets a module - typically preloaded
with -r - register a provider for a directory or archive format;
registered providers are tried first (newest wins, for directories as
well as files), so a custom provider can back, wrap, or vet any mount.
If none claims a source, the built-ins handle it: a directory with
RealFSProvider, and a file whose bytes are a ZIP archive with the
read-only ZipProvider. A ZIP is recognized by locating its
end-of-central-directory record - so an archive can carry any name and
even a prefix; a .zip name is accepted without reading, as a fast path.
A source no provider claims fails with ERR_VFS_INVALID_TARGET.

Workers inherit the parent's --vfs-mount targets unless they supply
their own execArgv with a --vfs-mount of their own.

Signed-off-by: Philipp Dunkel <pip@pipobscure.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant