vfs: add --vfs-mount startup flag - #7
Draft
pipobscure wants to merge 1 commit into
Draft
Conversation
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>
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.
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.