Prove that additional deferred-tree metadata can still be serialized and restored together with the groups already pending in this filesystem.
Materialize a full lazy archive group: fetch the zip once, parse its central directory, and write every non-deleted entry into its stub. Subsequent calls are no-ops.
Optionalrequested: { generation: number; ino: number; path: string }Backward-compatible explicit preparation entrypoint.
Export all pending lazy archive groups for transfer to another instance.
Export all pending lazy entries for transfer to another instance.
Return a copy of image-level metadata, or null if the image did not declare any.
Return lazy metadata for path, following symlinks through stat().
Import lazy archive groups from another instance. Assumes stubs already exist.
Import lazy file entries from another instance (e.g., main thread → worker). Does not create files — assumes the files already exist in the SharedArrayBuffer.
Authenticate sealed archive metadata before publishing it into this live filesystem. The caller must keep the underlying namespace quiescent while this asynchronous trust check runs.
Report whether path currently resolves to any deferred backing without
starting I/O. This follows symlinks and covers both legacy lazy files and
typed archive/tree registrations.
Materialize one exact typed tree authorized by this filesystem's opaque registration wrapper. Build-time composers use this to embed a reviewed package subset without re-pouring a smaller closure and thereby changing global path/conflict ownership.
Return aggregate resources that a saved image would retain lazily.
Resolve every tree whose capability policy requires bytes before boot. Registration/stat remain inert; callers choose the boot boundary and any failure aborts that boundary instead of exposing zero-byte stubs.
Async-materialize a lazy file or archive-backed file if the given path resolves to one. Call this before any synchronous read (e.g. in handleExec) to avoid sync XHR which deadlocks with COOP/COEP. Returns true if something was materialized, false if already concrete.
A thrown error must leave the next directory entry unconsumed.
Copy this filesystem into a freshly formatted SharedFS whose superblock
records maxByteLength as its growth ceiling. Lazy file/archive metadata
is rebuilt from paths so the destination carries the new inode numbers.
Register a lazy archive group: creates stubs in SharedFS for every file entry and records metadata so that accessing any one of them triggers a single archive fetch that materializes all files in the group.
Parse the zip's central directory (via host/src/vfs/zip.ts) and pass the
resulting ZipEntry[] in zipEntries. mountPrefix maps the zip's
internal paths into the VFS (e.g. prefix "/usr/" turns "bin/vim" into
"/usr/bin/vim").
OptionalsymlinkTargets: Map<string, string>Optionalintegrity: LazyArchiveIntegrityRegister a lazy file: creates an empty stub in SharedFS and records metadata for ensureMaterialized() to fetch asynchronously before a synchronous read or exec path consumes the file. Returns the inode number (useful for forwarding to other instances).
Register a format-neutral immutable filesystem tree. The complete inventory is validated before namespace mutation. One stub is created per inode group and hard-link names are attached to that same SharedFS inode.
OptionalactivationValue: LazyTreeActivationOptionalownerValue: LazyTreeRegistrationOwnerRegister one typed tree and return only an opaque direct-materialization authority. The mutable internal group is deliberately not exposed.
OptionalactivationValue: LazyTreeActivationOptionalownerValue: LazyTreeRegistrationOwnerRewrite the URL of every registered lazy archive group. Useful when the VFS image was built with relative URLs (e.g. "vim.zip") and the runtime needs to resolve them against a deployment base URL.
Rewrite the URL of every registered lazy file. Useful when a VFS image was built with placeholder URLs and the browser runtime needs to replace them with bundler-produced asset URLs.
Save the current filesystem state as a portable binary image.
With materializeAll: true, all lazy files are fetched and written
into the filesystem before saving, producing a self-contained image.
Otherwise, lazy file metadata (path/URL/size) is preserved in the
image and restored on load.
Optionaloptions: VfsImageOptionsFinalize one exact multi-tree activation cohort.
The caller supplies the producer-known member names so forgetting a tree cannot silently redefine the transaction. The resulting per-member and cohort digests are retained in every serialized tree record.
Set or clear image-level metadata for the next saveImage() call.
Install the host-specific transport used for lazy file and archive URLs.
Register a signal here rather than closing over one invisibly: Fetch
rejects with AbortSignal.reason unchanged, which may otherwise look like
a retryable TypeError or an ordinary mirror failure.
Cryptographically authenticate every pending sealed atomic cohort.
Image restore validates the closed v3 structure synchronously, but its SHA-256 claims remain untrusted until an asynchronous host digest pass. Await this before a caller needs synchronous metadata inspection or filesystem rebasing. This check does not fetch or materialize deferred trees, snapshot the filesystem, export metadata, or rebase storage.
Locally sealed cohorts are already authenticated; explicitly verifying them again is safe and idempotent.
StaticassertValidate an image's optional kernel ABI declaration. Images without a
kernelAbi declaration are accepted so legacy/data-only images keep
loading; callers that require an explicit declaration should check
readImageMetadata(image)?.kernelAbi first.
StaticcreateOptionalmaxSizeBytes: numberStaticfromStaticfromRestore a MemoryFileSystem from a previously saved VFS image. Allocates a new SharedArrayBuffer and populates it from the image.
This low-level synchronous parser cannot authenticate imported v3 atomic
seals. Normal imported-image consumers should await
restoreVerifiedVfsImage() instead; private format code must explicitly
await verifyImportedLazyAtomicGroupSeals() before it inspects, mutates,
or boots the restored filesystem.
When maxByteLength is specified, creates a growable SharedArrayBuffer
so the filesystem can expand beyond the image's original size, up to the
maximum already recorded in the image superblock.
Optionaloptions: VfsImageRestoreOptionsStaticfromRestore an image with the growth ceiling recorded in its SharedFS
superblock. This is the low-level synchronous parser; imported v3 atomic
seals remain unverified. Before inspecting, mutating, or booting imported
state, use restoreVerifiedVfsImagePreservingCapacity() or explicitly
await verifyImportedLazyAtomicGroupSeals().
Use fromImage() when a caller intentionally supplies a different runtime ceiling.
StaticreadRead the current and maximum filesystem sizes encoded in an image.
StaticreadRead image-level metadata without materializing the filesystem SAB.
Return the underlying SharedArrayBuffer (for sharing with workers).