memfs

  • Version 4.36.3
  • Published
  • 763 kB
  • 5 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, cwd?: string) => { 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 cwd

          Current working directory. The JSON structure will be created relative to this path.

          Returns

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

        Classes

        class Volume

        class Volume implements FsCallbackApi, FsSynchronousApi {}
        • Volume represents a file system.

        constructor

        constructor(_core?: Superblock);

          property access

          access: {
          (path: PathLike, callback: misc.TCallback<void>): any;
          (path: PathLike, mode: number, callback: misc.TCallback<void>): any;
          };

            property accessSync

            accessSync: (path: PathLike, mode?: number) => void;

              property appendFile

              appendFile: {
              (id: TFileId, data: TData, callback: misc.TCallback<void>): any;
              (
              id: TFileId,
              data: TData,
              options: IAppendFileOptions | string,
              callback: misc.TCallback<void>
              ): any;
              };

                property appendFileSync

                appendFileSync: (
                id: TFileId,
                data: TData,
                options?: IAppendFileOptions | string
                ) => void;

                  property chmod

                  chmod: (path: PathLike, mode: TMode, callback: misc.TCallback<void>) => void;

                    property chmodSync

                    chmodSync: (path: PathLike, mode: TMode) => void;

                      property chown

                      chown: (
                      path: PathLike,
                      uid: number,
                      gid: number,
                      callback: misc.TCallback<void>
                      ) => void;

                        property chownSync

                        chownSync: (path: PathLike, uid: number, gid: number) => void;

                          property close

                          close: (fd: number, callback: misc.TCallback<void>) => void;

                            property closeSync

                            closeSync: (fd: number) => void;

                              property copyFile

                              copyFile: {
                              (src: PathLike, dest: PathLike, callback: misc.TCallback<void>): any;
                              (
                              src: PathLike,
                              dest: PathLike,
                              flags: TFlagsCopy,
                              callback: misc.TCallback<void>
                              ): any;
                              };

                                property copyFileSync

                                copyFileSync: (src: PathLike, dest: PathLike, flags?: TFlagsCopy) => void;

                                  property cp

                                  cp: {
                                  (src: string | URL, dest: string | URL, callback: misc.TCallback<void>): any;
                                  (
                                  src: string | URL,
                                  dest: string | URL,
                                  options: opts.ICpOptions,
                                  callback: misc.TCallback<void>
                                  ): any;
                                  };

                                    property cpSync

                                    cpSync: (
                                    src: string | URL,
                                    dest: string | URL,
                                    options?: opts.ICpOptions
                                    ) => void;

                                      property exists

                                      exists: (path: PathLike, callback: (exists: boolean) => void) => void;

                                        property existsSync

                                        existsSync: (path: PathLike) => boolean;

                                          property fchmod

                                          fchmod: (fd: number, mode: TMode, callback: misc.TCallback<void>) => void;

                                            property fchmodSync

                                            fchmodSync: (fd: number, mode: TMode) => void;

                                              property fchown

                                              fchown: (
                                              fd: number,
                                              uid: number,
                                              gid: number,
                                              callback: misc.TCallback<void>
                                              ) => void;

                                                property fchownSync

                                                fchownSync: (fd: number, uid: number, gid: number) => void;

                                                  property fdatasync

                                                  fdatasync: (fd: number, callback: misc.TCallback<void>) => void;

                                                    property fdatasyncSync

                                                    fdatasyncSync: (fd: number) => void;

                                                      property fromJSON

                                                      static readonly fromJSON: (json: DirectoryJSON, cwd?: string) => Volume;

                                                        property fromNestedJSON

                                                        static readonly fromNestedJSON: (
                                                        json: NestedDirectoryJSON,
                                                        cwd?: string
                                                        ) => Volume;

                                                          property FSWatcher

                                                          FSWatcher: new () => FSWatcher;

                                                            property fsync

                                                            fsync: (fd: number, callback: misc.TCallback<void>) => void;

                                                              property fsyncSync

                                                              fsyncSync: (fd: number) => void;

                                                                property ftruncate

                                                                ftruncate: {
                                                                (fd: number, callback: misc.TCallback<void>): any;
                                                                (fd: number, len: number, callback: misc.TCallback<void>): any;
                                                                };

                                                                  property ftruncateSync

                                                                  ftruncateSync: (fd: number, len?: number) => void;

                                                                    property futimes

                                                                    futimes: (
                                                                    fd: number,
                                                                    atime: TTime,
                                                                    mtime: TTime,
                                                                    callback: misc.TCallback<void>
                                                                    ) => void;

                                                                      property futimesSync

                                                                      futimesSync: (fd: number, atime: TTime, mtime: TTime) => void;

                                                                        property glob

                                                                        glob: {
                                                                        (pattern: string, callback: misc.TCallback<string[]>): void;
                                                                        (
                                                                        pattern: string,
                                                                        options: opts.IGlobOptions,
                                                                        callback: misc.TCallback<string[]>
                                                                        ): void;
                                                                        };

                                                                          property globSync

                                                                          globSync: (pattern: string, options?: opts.IGlobOptions) => string[];

                                                                            property lchmod

                                                                            lchmod: (path: PathLike, mode: TMode, callback: misc.TCallback<void>) => void;

                                                                              property lchmodSync

                                                                              lchmodSync: (path: PathLike, mode: TMode) => void;

                                                                                property lchown

                                                                                lchown: (
                                                                                path: PathLike,
                                                                                uid: number,
                                                                                gid: number,
                                                                                callback: misc.TCallback<void>
                                                                                ) => void;

                                                                                  property lchownSync

                                                                                  lchownSync: (path: PathLike, uid: number, gid: number) => void;
                                                                                    link: (
                                                                                    existingPath: PathLike,
                                                                                    newPath: PathLike,
                                                                                    callback: misc.TCallback<void>
                                                                                    ) => void;

                                                                                      property linkSync

                                                                                      linkSync: (existingPath: PathLike, newPath: PathLike) => void;

                                                                                        property lstatSync

                                                                                        lstatSync: {
                                                                                        (path: PathLike): Stats<number>;
                                                                                        (
                                                                                        path: PathLike,
                                                                                        options: { throwIfNoEntry?: true | undefined }
                                                                                        ): Stats<number>;
                                                                                        (
                                                                                        path: PathLike,
                                                                                        options: { bigint: false; throwIfNoEntry?: true | undefined }
                                                                                        ): Stats<number>;
                                                                                        (
                                                                                        path: PathLike,
                                                                                        options: { bigint: true; throwIfNoEntry?: true | undefined }
                                                                                        ): Stats<bigint>;
                                                                                        (path: PathLike, options: { throwIfNoEntry: false }):
                                                                                        | Stats<number>
                                                                                        | undefined;
                                                                                        (path: PathLike, options: { bigint: false; throwIfNoEntry: false }):
                                                                                        | Stats<number>
                                                                                        | undefined;
                                                                                        (path: PathLike, options: { bigint: true; throwIfNoEntry: false }):
                                                                                        | Stats<bigint>
                                                                                        | undefined;
                                                                                        };

                                                                                          property lutimes

                                                                                          lutimes: (
                                                                                          path: PathLike,
                                                                                          atime: TTime,
                                                                                          mtime: TTime,
                                                                                          callback: misc.TCallback<void>
                                                                                          ) => void;

                                                                                            property lutimesSync

                                                                                            lutimesSync: (path: PathLike, atime: TTime, mtime: TTime) => void;

                                                                                              property mkdir

                                                                                              mkdir: {
                                                                                              (path: PathLike, callback: misc.TCallback<void>): any;
                                                                                              (
                                                                                              path: PathLike,
                                                                                              mode: TMode | (opts.IMkdirOptions & { recursive?: false }),
                                                                                              callback: misc.TCallback<void>
                                                                                              ): any;
                                                                                              (
                                                                                              path: PathLike,
                                                                                              mode: opts.IMkdirOptions & { recursive: true },
                                                                                              callback: misc.TCallback<string>
                                                                                              ): any;
                                                                                              (
                                                                                              path: PathLike,
                                                                                              mode: TMode | opts.IMkdirOptions,
                                                                                              callback: misc.TCallback<string>
                                                                                              ): any;
                                                                                              };

                                                                                                property mkdirSync

                                                                                                mkdirSync: {
                                                                                                (path: PathLike, options: opts.IMkdirOptions & { recursive: true }):
                                                                                                | string
                                                                                                | undefined;
                                                                                                (
                                                                                                path: PathLike,
                                                                                                options?: TMode | (opts.IMkdirOptions & { recursive?: false })
                                                                                                ): void;
                                                                                                (path: PathLike, options?: TMode | opts.IMkdirOptions): string | undefined;
                                                                                                };

                                                                                                  property mkdtemp

                                                                                                  mkdtemp: {
                                                                                                  (prefix: string, callback: misc.TCallback<string>): any;
                                                                                                  (
                                                                                                  prefix: string,
                                                                                                  options: opts.IOptions,
                                                                                                  callback: misc.TCallback<string>
                                                                                                  ): any;
                                                                                                  };

                                                                                                    property mkdtempSync

                                                                                                    mkdtempSync: (prefix: string, options?: opts.IOptions) => TDataOut;

                                                                                                      property open

                                                                                                      open: {
                                                                                                      (path: PathLike, flags: TFlags, callback: misc.TCallback<number>): void;
                                                                                                      (
                                                                                                      path: PathLike,
                                                                                                      flags: TFlags,
                                                                                                      mode: TMode,
                                                                                                      callback: misc.TCallback<number>
                                                                                                      ): void;
                                                                                                      };

                                                                                                        property openAsBlob

                                                                                                        openAsBlob: (path: PathLike, options?: opts.IOpenAsBlobOptions) => Promise<Blob>;

                                                                                                          property opendir

                                                                                                          opendir: {
                                                                                                          (path: PathLike, callback: misc.TCallback<Dir>): any;
                                                                                                          (
                                                                                                          path: PathLike,
                                                                                                          options: opts.IOpendirOptions | string,
                                                                                                          callback: misc.TCallback<Dir>
                                                                                                          ): any;
                                                                                                          };

                                                                                                            property opendirSync

                                                                                                            opendirSync: (path: PathLike, options?: opts.IOpendirOptions | string) => Dir;

                                                                                                              property openSync

                                                                                                              openSync: (path: PathLike, flags: TFlags, mode?: TMode) => number;

                                                                                                                property promises

                                                                                                                readonly promises: FsPromisesApi;

                                                                                                                  property read

                                                                                                                  read: (
                                                                                                                  fd: number,
                                                                                                                  buffer: Buffer | ArrayBufferView | DataView,
                                                                                                                  offset: number,
                                                                                                                  length: number,
                                                                                                                  position: number | null,
                                                                                                                  callback: (
                                                                                                                  err?: Error | null,
                                                                                                                  bytesRead?: number,
                                                                                                                  buffer?: Buffer | ArrayBufferView | DataView
                                                                                                                  ) => void
                                                                                                                  ) => void;

                                                                                                                    property readdir

                                                                                                                    readdir: {
                                                                                                                    (path: PathLike, callback: misc.TCallback<TDataOut[] | Dirent[]>): any;
                                                                                                                    (
                                                                                                                    path: PathLike,
                                                                                                                    options: opts.IReaddirOptions | string,
                                                                                                                    callback: misc.TCallback<TDataOut[] | Dirent[]>
                                                                                                                    ): any;
                                                                                                                    };

                                                                                                                      property readdirSync

                                                                                                                      readdirSync: (
                                                                                                                      path: PathLike,
                                                                                                                      options?: opts.IReaddirOptions | string
                                                                                                                      ) => TDataOut[] | Dirent[];

                                                                                                                        property readFile

                                                                                                                        readFile: {
                                                                                                                        (id: TFileId, callback: misc.TCallback<TDataOut>): any;
                                                                                                                        (
                                                                                                                        id: TFileId,
                                                                                                                        options: opts.IReadFileOptions | string,
                                                                                                                        callback: misc.TCallback<TDataOut>
                                                                                                                        ): any;
                                                                                                                        };

                                                                                                                          property readFileSync

                                                                                                                          readFileSync: (
                                                                                                                          file: TFileId,
                                                                                                                          options?: opts.IReadFileOptions | string
                                                                                                                          ) => TDataOut;
                                                                                                                            readlink: {
                                                                                                                            (path: PathLike, callback: misc.TCallback<TDataOut>): any;
                                                                                                                            (
                                                                                                                            path: PathLike,
                                                                                                                            options: opts.IOptions,
                                                                                                                            callback: misc.TCallback<TDataOut>
                                                                                                                            ): any;
                                                                                                                            };

                                                                                                                              property readlinkSync

                                                                                                                              readlinkSync: (path: PathLike, options?: opts.IOptions) => TDataOut;

                                                                                                                                property ReadStream

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

                                                                                                                                  property readSync

                                                                                                                                  readSync: (
                                                                                                                                  fd: number,
                                                                                                                                  buffer: Buffer | ArrayBufferView | DataView,
                                                                                                                                  offset: number,
                                                                                                                                  length: number,
                                                                                                                                  position: number | null
                                                                                                                                  ) => number;

                                                                                                                                    property readv

                                                                                                                                    readv: {
                                                                                                                                    (
                                                                                                                                    fd: number,
                                                                                                                                    buffers: ArrayBufferView[],
                                                                                                                                    callback: misc.TCallback2<number, ArrayBufferView[]>
                                                                                                                                    ): void;
                                                                                                                                    (
                                                                                                                                    fd: number,
                                                                                                                                    buffers: ArrayBufferView[],
                                                                                                                                    position: number | null,
                                                                                                                                    callback: misc.TCallback2<number, ArrayBufferView[]>
                                                                                                                                    ): void;
                                                                                                                                    };

                                                                                                                                      property readvSync

                                                                                                                                      readvSync: (
                                                                                                                                      fd: number,
                                                                                                                                      buffers: ArrayBufferView[],
                                                                                                                                      position?: number | null
                                                                                                                                      ) => number;

                                                                                                                                        property realpath

                                                                                                                                        realpath: {
                                                                                                                                        (path: PathLike, callback: misc.TCallback<TDataOut>): void;
                                                                                                                                        (
                                                                                                                                        path: PathLike,
                                                                                                                                        options: opts.IRealpathOptions | string,
                                                                                                                                        callback: misc.TCallback<TDataOut>
                                                                                                                                        ): void;
                                                                                                                                        native: {
                                                                                                                                        (path: PathLike, callback: misc.TCallback<TDataOut>): void;
                                                                                                                                        (
                                                                                                                                        path: PathLike,
                                                                                                                                        options: opts.IRealpathOptions | string,
                                                                                                                                        callback: misc.TCallback<TDataOut>
                                                                                                                                        ): void;
                                                                                                                                        };
                                                                                                                                        };

                                                                                                                                          property realpathSync

                                                                                                                                          realpathSync: {
                                                                                                                                          (path: PathLike, options?: opts.IRealpathOptions | string): TDataOut;
                                                                                                                                          native: (
                                                                                                                                          path: PathLike,
                                                                                                                                          options?: opts.IRealpathOptions | string
                                                                                                                                          ) => TDataOut;
                                                                                                                                          };

                                                                                                                                            property rename

                                                                                                                                            rename: (
                                                                                                                                            oldPath: PathLike,
                                                                                                                                            newPath: PathLike,
                                                                                                                                            callback: misc.TCallback<void>
                                                                                                                                            ) => void;

                                                                                                                                              property renameSync

                                                                                                                                              renameSync: (oldPath: PathLike, newPath: PathLike) => void;

                                                                                                                                                property rm

                                                                                                                                                rm: {
                                                                                                                                                (path: PathLike, callback: misc.TCallback<void>): void;
                                                                                                                                                (
                                                                                                                                                path: PathLike,
                                                                                                                                                options: opts.IRmOptions,
                                                                                                                                                callback: misc.TCallback<void>
                                                                                                                                                ): void;
                                                                                                                                                };

                                                                                                                                                  property rmdir

                                                                                                                                                  rmdir: {
                                                                                                                                                  (path: PathLike, callback: misc.TCallback<void>): any;
                                                                                                                                                  (
                                                                                                                                                  path: PathLike,
                                                                                                                                                  options: opts.IRmdirOptions,
                                                                                                                                                  callback: misc.TCallback<void>
                                                                                                                                                  ): any;
                                                                                                                                                  };

                                                                                                                                                    property rmdirSync

                                                                                                                                                    rmdirSync: (path: PathLike, options?: opts.IRmdirOptions) => void;

                                                                                                                                                      property rmSync

                                                                                                                                                      rmSync: (path: PathLike, options?: opts.IRmOptions) => void;

                                                                                                                                                        property StatWatcher

                                                                                                                                                        StatWatcher: new () => StatWatcher;
                                                                                                                                                          symlink: {
                                                                                                                                                          (target: PathLike, path: PathLike, callback: misc.TCallback<void>): any;
                                                                                                                                                          (
                                                                                                                                                          target: PathLike,
                                                                                                                                                          path: PathLike,
                                                                                                                                                          type: symlink.Type,
                                                                                                                                                          callback: misc.TCallback<void>
                                                                                                                                                          ): any;
                                                                                                                                                          };

                                                                                                                                                            property symlinkSync

                                                                                                                                                            symlinkSync: (target: PathLike, path: PathLike, type?: symlink.Type) => void;
                                                                                                                                                            • type argument works only on Windows.

                                                                                                                                                              Parameter target

                                                                                                                                                              Parameter path

                                                                                                                                                              Parameter type

                                                                                                                                                            property truncate

                                                                                                                                                            truncate: {
                                                                                                                                                            (id: TFileId, callback: misc.TCallback<void>): any;
                                                                                                                                                            (id: TFileId, len: number, callback: misc.TCallback<void>): any;
                                                                                                                                                            };

                                                                                                                                                              property truncateSync

                                                                                                                                                              truncateSync: (id: TFileId, len?: number) => void;
                                                                                                                                                              • id should be a file descriptor or a path. id as file descriptor will not be supported soon.

                                                                                                                                                              unlink: (path: PathLike, callback: misc.TCallback<void>) => void;

                                                                                                                                                                property unlinkSync

                                                                                                                                                                unlinkSync: (path: PathLike) => void;

                                                                                                                                                                  property utimes

                                                                                                                                                                  utimes: (
                                                                                                                                                                  path: PathLike,
                                                                                                                                                                  atime: TTime,
                                                                                                                                                                  mtime: TTime,
                                                                                                                                                                  callback: misc.TCallback<void>
                                                                                                                                                                  ) => void;

                                                                                                                                                                    property utimesSync

                                                                                                                                                                    utimesSync: (path: PathLike, atime: TTime, mtime: TTime) => void;

                                                                                                                                                                      property write

                                                                                                                                                                      write: {
                                                                                                                                                                      (
                                                                                                                                                                      fd: number,
                                                                                                                                                                      buffer: Buffer | ArrayBufferView | DataView,
                                                                                                                                                                      callback: (...args: any[]) => void
                                                                                                                                                                      ): any;
                                                                                                                                                                      (
                                                                                                                                                                      fd: number,
                                                                                                                                                                      buffer: Buffer | ArrayBufferView | DataView,
                                                                                                                                                                      offset: number,
                                                                                                                                                                      callback: (...args: any[]) => void
                                                                                                                                                                      ): any;
                                                                                                                                                                      (
                                                                                                                                                                      fd: number,
                                                                                                                                                                      buffer: Buffer | ArrayBufferView | DataView,
                                                                                                                                                                      offset: number,
                                                                                                                                                                      length: number,
                                                                                                                                                                      callback: (...args: any[]) => void
                                                                                                                                                                      ): any;
                                                                                                                                                                      (
                                                                                                                                                                      fd: number,
                                                                                                                                                                      buffer: Buffer | ArrayBufferView | DataView,
                                                                                                                                                                      offset: number,
                                                                                                                                                                      length: number,
                                                                                                                                                                      position: number,
                                                                                                                                                                      callback: (...args: any[]) => void
                                                                                                                                                                      ): any;
                                                                                                                                                                      (fd: number, str: string, callback: (...args: any[]) => void): any;
                                                                                                                                                                      (
                                                                                                                                                                      fd: number,
                                                                                                                                                                      str: string,
                                                                                                                                                                      position: number,
                                                                                                                                                                      callback: (...args: any[]) => void
                                                                                                                                                                      ): any;
                                                                                                                                                                      (
                                                                                                                                                                      fd: number,
                                                                                                                                                                      str: string,
                                                                                                                                                                      position: number,
                                                                                                                                                                      encoding: BufferEncoding,
                                                                                                                                                                      callback: (...args: any[]) => void
                                                                                                                                                                      ): any;
                                                                                                                                                                      };

                                                                                                                                                                        property writeFile

                                                                                                                                                                        writeFile: {
                                                                                                                                                                        (id: TFileId, data: TData, callback: misc.TCallback<void>): void;
                                                                                                                                                                        (
                                                                                                                                                                        id: TFileId,
                                                                                                                                                                        data: TData,
                                                                                                                                                                        options: opts.IWriteFileOptions | string,
                                                                                                                                                                        callback: misc.TCallback<void>
                                                                                                                                                                        ): void;
                                                                                                                                                                        };

                                                                                                                                                                          property writeFileSync

                                                                                                                                                                          writeFileSync: (
                                                                                                                                                                          id: TFileId,
                                                                                                                                                                          data: TData,
                                                                                                                                                                          options?: opts.IWriteFileOptions
                                                                                                                                                                          ) => void;

                                                                                                                                                                            property WriteStream

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

                                                                                                                                                                              property writeSync

                                                                                                                                                                              writeSync: {
                                                                                                                                                                              (
                                                                                                                                                                              fd: number,
                                                                                                                                                                              buffer: Buffer | ArrayBufferView | DataView,
                                                                                                                                                                              offset?: number,
                                                                                                                                                                              length?: number,
                                                                                                                                                                              position?: number | null
                                                                                                                                                                              ): number;
                                                                                                                                                                              (
                                                                                                                                                                              fd: number,
                                                                                                                                                                              str: string,
                                                                                                                                                                              position?: number,
                                                                                                                                                                              encoding?: BufferEncoding
                                                                                                                                                                              ): number;
                                                                                                                                                                              };

                                                                                                                                                                                property writev

                                                                                                                                                                                writev: {
                                                                                                                                                                                (fd: number, buffers: ArrayBufferView[], callback: WritevCallback): void;
                                                                                                                                                                                (
                                                                                                                                                                                fd: number,
                                                                                                                                                                                buffers: ArrayBufferView[],
                                                                                                                                                                                position: number | null,
                                                                                                                                                                                callback: WritevCallback
                                                                                                                                                                                ): void;
                                                                                                                                                                                };

                                                                                                                                                                                  property writevSync

                                                                                                                                                                                  writevSync: (
                                                                                                                                                                                  fd: number,
                                                                                                                                                                                  buffers: ArrayBufferView[],
                                                                                                                                                                                  position?: number | null
                                                                                                                                                                                  ) => number;

                                                                                                                                                                                    method createReadStream

                                                                                                                                                                                    createReadStream: (
                                                                                                                                                                                    path: misc.PathLike,
                                                                                                                                                                                    options?: opts.IReadStreamOptions | string
                                                                                                                                                                                    ) => misc.IReadStream;

                                                                                                                                                                                      method createWriteStream

                                                                                                                                                                                      createWriteStream: (
                                                                                                                                                                                      path: PathLike,
                                                                                                                                                                                      options?: opts.IWriteStreamOptions | string
                                                                                                                                                                                      ) => IWriteStream;

                                                                                                                                                                                        method fromJSON

                                                                                                                                                                                        fromJSON: (json: DirectoryJSON, cwd?: string) => void;

                                                                                                                                                                                          method fromNestedJSON

                                                                                                                                                                                          fromNestedJSON: (json: NestedDirectoryJSON, cwd?: string) => void;

                                                                                                                                                                                            method fstat

                                                                                                                                                                                            fstat: {
                                                                                                                                                                                            (fd: number, callback: misc.TCallback<Stats>): void;
                                                                                                                                                                                            (
                                                                                                                                                                                            fd: number,
                                                                                                                                                                                            options: opts.IFStatOptions,
                                                                                                                                                                                            callback: misc.TCallback<Stats<TStatNumber>>
                                                                                                                                                                                            ): void;
                                                                                                                                                                                            };

                                                                                                                                                                                              method fstatSync

                                                                                                                                                                                              fstatSync: {
                                                                                                                                                                                              (fd: number): Stats<number>;
                                                                                                                                                                                              (fd: number, options: { bigint: false }): Stats<number>;
                                                                                                                                                                                              (fd: number, options: { bigint: true }): Stats<bigint>;
                                                                                                                                                                                              };

                                                                                                                                                                                                method lstat

                                                                                                                                                                                                lstat: {
                                                                                                                                                                                                (path: PathLike, callback: misc.TCallback<Stats>): void;
                                                                                                                                                                                                (
                                                                                                                                                                                                path: any,
                                                                                                                                                                                                options: opts.IStatOptions,
                                                                                                                                                                                                callback: misc.TCallback<Stats<TStatNumber>>
                                                                                                                                                                                                ): void;
                                                                                                                                                                                                };

                                                                                                                                                                                                  method mountSync

                                                                                                                                                                                                  mountSync: (mountpoint: string, json: DirectoryJSON) => void;

                                                                                                                                                                                                    method reset

                                                                                                                                                                                                    reset: () => void;

                                                                                                                                                                                                      method stat

                                                                                                                                                                                                      stat: {
                                                                                                                                                                                                      (path: PathLike, callback: misc.TCallback<Stats>): void;
                                                                                                                                                                                                      (
                                                                                                                                                                                                      path: any,
                                                                                                                                                                                                      options: opts.IStatOptions,
                                                                                                                                                                                                      callback: misc.TCallback<Stats<TStatNumber>>
                                                                                                                                                                                                      ): void;
                                                                                                                                                                                                      };

                                                                                                                                                                                                        method statfs

                                                                                                                                                                                                        statfs: {
                                                                                                                                                                                                        (path: PathLike, callback: misc.TCallback<StatFs>): void;
                                                                                                                                                                                                        (
                                                                                                                                                                                                        path: any,
                                                                                                                                                                                                        options: opts.IStafsOptions,
                                                                                                                                                                                                        callback: misc.TCallback<StatFs<TStatNumber>>
                                                                                                                                                                                                        ): void;
                                                                                                                                                                                                        };

                                                                                                                                                                                                          method statfsSync

                                                                                                                                                                                                          statfsSync: {
                                                                                                                                                                                                          (path: PathLike): StatFs<number>;
                                                                                                                                                                                                          (path: any, options: { bigint: false }): StatFs<number>;
                                                                                                                                                                                                          (path: any, options: { bigint: true }): StatFs<bigint>;
                                                                                                                                                                                                          };

                                                                                                                                                                                                            method statSync

                                                                                                                                                                                                            statSync: {
                                                                                                                                                                                                            (path: PathLike): Stats<number>;
                                                                                                                                                                                                            (path: any, options: { throwIfNoEntry?: true }): Stats<number>;
                                                                                                                                                                                                            (path: any, options: { throwIfNoEntry: false }): Stats<number>;
                                                                                                                                                                                                            (
                                                                                                                                                                                                            path: any,
                                                                                                                                                                                                            options: { bigint: false; throwIfNoEntry?: true }
                                                                                                                                                                                                            ): Stats<number>;
                                                                                                                                                                                                            (path: any, options: { bigint: true; throwIfNoEntry?: true }): Stats<bigint>;
                                                                                                                                                                                                            (
                                                                                                                                                                                                            path: any,
                                                                                                                                                                                                            options: { bigint: false; throwIfNoEntry: false }
                                                                                                                                                                                                            ): Stats<number>;
                                                                                                                                                                                                            (path: any, options: { bigint: true; throwIfNoEntry: false }): Stats<bigint>;
                                                                                                                                                                                                            };

                                                                                                                                                                                                              method toJSON

                                                                                                                                                                                                              toJSON: (
                                                                                                                                                                                                              paths?: PathLike | PathLike[],
                                                                                                                                                                                                              json?: {},
                                                                                                                                                                                                              isRelative?: boolean,
                                                                                                                                                                                                              asBuffer?: boolean
                                                                                                                                                                                                              ) => DirectoryJSON<string | null>;

                                                                                                                                                                                                                method toTree

                                                                                                                                                                                                                toTree: (opts?: ToTreeOptions) => string;

                                                                                                                                                                                                                  method unwatchFile

                                                                                                                                                                                                                  unwatchFile: (
                                                                                                                                                                                                                  path: PathLike,
                                                                                                                                                                                                                  listener?: (curr: Stats, prev: Stats) => void
                                                                                                                                                                                                                  ) => void;

                                                                                                                                                                                                                    method watch

                                                                                                                                                                                                                    watch: (
                                                                                                                                                                                                                    path: PathLike,
                                                                                                                                                                                                                    options?: IWatchOptions | string,
                                                                                                                                                                                                                    listener?: (eventType: string, filename: string) => void
                                                                                                                                                                                                                    ) => FSWatcher;

                                                                                                                                                                                                                      method watchFile

                                                                                                                                                                                                                      watchFile: {
                                                                                                                                                                                                                      (path: PathLike, listener: (curr: Stats, prev: Stats) => void): StatWatcher;
                                                                                                                                                                                                                      (
                                                                                                                                                                                                                      path: any,
                                                                                                                                                                                                                      options: IWatchFileOptions,
                                                                                                                                                                                                                      listener: (curr: Stats<TStatNumber>, prev: Stats<TStatNumber>) => void
                                                                                                                                                                                                                      ): StatWatcher;
                                                                                                                                                                                                                      };

                                                                                                                                                                                                                        Interfaces

                                                                                                                                                                                                                        interface DirectoryJSON

                                                                                                                                                                                                                        interface DirectoryJSON<T extends DirectoryContent = DirectoryContent> {}

                                                                                                                                                                                                                          index signature

                                                                                                                                                                                                                          [key: string]: T;

                                                                                                                                                                                                                            interface IFs

                                                                                                                                                                                                                            interface IFs extends Volume {}

                                                                                                                                                                                                                              property constants

                                                                                                                                                                                                                              constants: typeof constants;

                                                                                                                                                                                                                                property Dirent

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

                                                                                                                                                                                                                                  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 NestedDirectoryJSON

                                                                                                                                                                                                                                              interface NestedDirectoryJSON<T extends DirectoryContent = DirectoryContent> {}

                                                                                                                                                                                                                                                index signature

                                                                                                                                                                                                                                                [key: string]: T | NestedDirectoryJSON;

                                                                                                                                                                                                                                                  Type Aliases

                                                                                                                                                                                                                                                  type IFsWithVolume

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

                                                                                                                                                                                                                                                    Package Files (3)

                                                                                                                                                                                                                                                    Dependencies (5)

                                                                                                                                                                                                                                                    Dev Dependencies (31)

                                                                                                                                                                                                                                                    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>