memfs

  • Version 4.76.0
  • Published
  • 73.7 kB
  • 14 dependencies
  • Apache-2.0 license

Install

npm i memfs
yarn add memfs
pnpm add memfs

Overview

In-memory file-system with Node's fs API.

Index

Variables

variable fs

const fs: IFs;

    variable vol

    const vol: Volume;

      Functions

      function createFsFromVolume

      createFsFromVolume: (vol: Volume) => IFs;

        function memfs

        memfs: (
        json?: NestedDirectoryJSON,
        cwdOrOpts?: string | MemfsOptions
        ) => { fs: IFs; vol: Volume };
        • Creates a new file system instance.

          Parameter json

          File system structure expressed as a JSON object. Use null for empty directories and empty string for empty files.

          Parameter cwdOrOpts

          Current working directory (string) or options object. The JSON structure will be created relative to the cwd path.

          Returns

          A memfs file system instance, which is a drop-in replacement for the fs module.

        Interfaces

        interface IFs

        interface IFs extends Volume {}

          property constants

          constants: typeof constants;

            property Dir

            Dir: new (...args: any[]) => Dir;

              property Dirent

              Dirent: new (...args: any[]) => Dirent;

                property FileReadStream

                FileReadStream: new (...args: any[]) => misc.IReadStream;

                  property FileWriteStream

                  FileWriteStream: new (...args: any[]) => IWriteStream;

                    property FSWatcher

                    FSWatcher: new () => FSWatcher;

                      property promises

                      promises: FsPromisesApi;

                        property ReadStream

                        ReadStream: new (...args: any[]) => misc.IReadStream;

                          property Stats

                          Stats: new (...args: any[]) => Stats;

                            property StatWatcher

                            StatWatcher: new () => StatWatcher;

                              property WriteStream

                              WriteStream: new (...args: any[]) => IWriteStream;

                                interface MemfsOptions

                                interface MemfsOptions {}
                                • Options for creating a memfs instance.

                                property cwd

                                cwd?: string;
                                • Custom working directory for resolving relative paths. Defaults to '/'.

                                property process

                                process?: IProcess;
                                • Custom process-like object for controlling platform, uid, gid, and cwd behavior.

                                Type Aliases

                                type IFsWithVolume

                                type IFsWithVolume = IFs & {
                                __vol: Volume;
                                };

                                  Package Files (1)

                                  Dependencies (14)

                                  Dev Dependencies (28)

                                  Peer Dependencies (0)

                                  No peer dependencies.

                                  Badge

                                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/memfs.

                                  • Markdown
                                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/memfs)
                                  • HTML
                                    <a href="https://www.jsdocs.io/package/memfs"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>