On this page

    M

    vfs.create

    History
    vfs.create(provider?, options?): VirtualFileSystem
    Attributes
    provider?:VirtualProvider
    The provider to use. Default: new MemoryProvider().
    options:Object
    emitExperimentalWarning?:boolean
    Whether to emit the experimental warning when the instance is created. Default: true.

    Convenience factory equivalent to new VirtualFileSystem(provider, options).

    const vfs = require('node:vfs');
    
    // Default in-memory provider
    const memoryVfs = vfs.create();
    
    // Explicit provider
    const realVfs = vfs.create(new vfs.RealFSProvider('/tmp/vfs-root'));