diff --git a/doc/api/vfs.md b/doc/api/vfs.md index f12ca239e166..8d65d8f08c2f 100644 --- a/doc/api/vfs.md +++ b/doc/api/vfs.md @@ -152,6 +152,29 @@ $ node --experimental-vfs --require ./provider.js \ --vfs-load archive.customfmt ``` +## `vfs.vfsBase()` + + + +* Returns: {string} The absolute path of the [reserved root directory][]. + +Returns the directory that holds the mount points of every mounted virtual file +system, which is `path.join(os.devNull, 'vfs')`. Reading it lists what is +mounted; see [The reserved root directory][reserved root directory]. + +```cjs +const vfs = require('node:vfs'); +const fs = require('node:fs'); + +const myVfs = vfs.create(); +const mountPoint = myVfs.mount(); + +fs.readdirSync(vfs.vfsBase()); // The name of every mount point in it +mountPoint.startsWith(vfs.vfsBase()); // true +``` + ## Class: `VirtualFileSystem`