ComposableProvider combines one or more providers in priority order. The first
provider is the writable layer; reads search from first to last. Directories
are merged, with entries in higher-priority layers shadowing entries with the
same name in lower layers. Writes to a lower file copy it to the first provider
before changing it. Removing a file hides lower copies without deleting them.
The first provider must be writable to change the composed file system.
new ComposableProvider(providers): ComposableProvider
VirtualProvider[]const vfs = require('node:vfs'); const memory = new vfs.MemoryProvider(); const disk = new vfs.RealFSProvider('/tmp/vfs-root'); const combined = vfs.create(new vfs.ComposableProvider([memory, disk])); combined.writeFileSync('/config.json', '{"debug":true}'); // The file in memory shadows /tmp/vfs-root/config.json.
A copy of the ordered provider list. Changes to this array do not affect the composition. File handles opened before a write continue to refer to the layer on which they were opened. Watching a path watches only its currently selected provider, not changes across the entire composition. Symbolic links are resolved by the provider containing them, not across providers. Traversal through a symbolic-link directory is not supported by the composition. Renaming a directory over a directory that exists only in a lower layer is not supported. Layer selection and copy-up use synchronous provider operations, including when invoked through the asynchronous VFS API.