constructor

vfs.RealFSProvider.constructor

Not implemented in Bun

constructor RealFSProvider(
rootPath: string
const vfs = require('node:vfs');

const realVfs = vfs.create(new vfs.RealFSProvider('/tmp/sandbox'));
realVfs.writeFileSync('/file.txt', 'hello'); // writes /tmp/sandbox/file.txt
@param rootPath

The absolute file-system path to use as the root. Must be a non-empty string.

Referenced types

class RealFSProvider

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.

  • readonly rootPath: string

    The resolved absolute path used as the root.