A provider that wraps a directory (i.e. one on the actual file system) and exposes its contents through the VFS API. All VFS paths are resolved relative to the root and verified to stay inside it; symbolic links resolving outside the root are rejected. This path mapping is not a sandbox or access-control mechanism.
new RealFSProvider(rootPath): RealFSProvider
Attributes
rootPath:
stringThe absolute file-system path to use as the root.
Must be a non-empty string.
const vfs = require('node:vfs'); const realVfs = vfs.create(new vfs.RealFSProvider('/tmp/vfs-root')); realVfs.writeFileSync('/file.txt', 'hello'); // writes /tmp/vfs-root/file.txt
Attributes
The resolved absolute path used as the root.