memfs

  • Version 4.17.2
  • Published
  • 683 kB
  • 4 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(props?: {});

          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 fd

              static fd: number;
              • Global file descriptor counter. UNIX file descriptors start from 0 and go sequentially up, so here, in order not to conflict with them, we choose some big number and descrease the file descriptor of every new opened file. {number} This should not be static, right?

              property fds

              fds: { [fd: number]: File };

                property FSWatcher

                FSWatcher: new () => FSWatcher;

                  property ino

                  ino: number;

                    property inodes

                    inodes: { [ino: number]: Node };

                      property maxFiles

                      maxFiles: number;

                        property openAsBlob

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

                          property openFiles

                          openFiles: number;

                            property promises

                            readonly promises: FsPromisesApi;

                              property props

                              props: {
                              Node: new (...args: any[]) => Node;
                              Link: new (...args: any[]) => Link;
                              File: new (...args: any[]) => File;
                              };

                                property ReadStream

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

                                  property releasedFds

                                  releasedFds: number[];

                                    property releasedInos

                                    releasedInos: number[];

                                      property root

                                      root: Link;

                                        property statfs

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

                                          property statfsSync

                                          statfsSync: (
                                          path: any,
                                          options?: opts.IStafsOptions
                                          ) => misc.IStatFs<misc.TStatNumber>;

                                            property StatWatcher

                                            StatWatcher: new () => StatWatcher;

                                              property WriteStream

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

                                                method access

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

                                                  method accessSync

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

                                                    method appendFile

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

                                                      method appendFileSync

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

                                                        method chmod

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

                                                          method chmodSync

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

                                                            method chown

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

                                                              method chownSync

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

                                                                method close

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

                                                                  method closeSync

                                                                  closeSync: (fd: number) => void;

                                                                    method copyFile

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

                                                                      method copyFileSync

                                                                      copyFileSync: (src: PathLike, dest: PathLike, flags?: TFlagsCopy) => void;
                                                                        createLink: {
                                                                        (): Link;
                                                                        (parent: Link, name: string, isDirectory?: boolean, mode?: number): Link;
                                                                        };

                                                                          method createNode

                                                                          createNode: (mode: number) => Node;

                                                                            method createReadStream

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

                                                                              method createWriteStream

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

                                                                                  method exists

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

                                                                                    method existsSync

                                                                                    existsSync: (path: PathLike) => boolean;

                                                                                      method fchmod

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

                                                                                        method fchmodSync

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

                                                                                          method fchown

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

                                                                                            method fchownSync

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

                                                                                              method fdatasync

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

                                                                                                method fdatasyncSync

                                                                                                fdatasyncSync: (fd: number) => void;

                                                                                                  method fromJSON

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

                                                                                                    method fromNestedJSON

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

                                                                                                      method fstat

                                                                                                      fstat: {
                                                                                                      (fd: number, callback: TCallback<Stats>): void;
                                                                                                      (
                                                                                                      fd: number,
                                                                                                      options: opts.IFStatOptions,
                                                                                                      callback: 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 fsync

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

                                                                                                            method fsyncSync

                                                                                                            fsyncSync: (fd: number) => void;

                                                                                                              method ftruncate

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

                                                                                                                method ftruncateSync

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

                                                                                                                  method futimes

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

                                                                                                                    method futimesSync

                                                                                                                    futimesSync: (fd: number, atime: TTime, mtime: TTime) => void;
                                                                                                                      getLink: (steps: string[]) => Link | null;

                                                                                                                        method getLinkOrThrow

                                                                                                                        getLinkOrThrow: (filename: string, funcName?: string) => Link;
                                                                                                                          getResolvedLink: (filenameOrSteps: string | string[]) => Link | null;

                                                                                                                            method getResolvedLinkOrThrow

                                                                                                                            getResolvedLinkOrThrow: (filename: string, funcName?: string) => Link;

                                                                                                                              method lchmod

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

                                                                                                                                method lchmodSync

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

                                                                                                                                  method lchown

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

                                                                                                                                    method lchownSync

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

                                                                                                                                        method linkSync

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

                                                                                                                                          method lstat

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

                                                                                                                                            method lstatSync

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

                                                                                                                                              method lutimes

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

                                                                                                                                                method lutimesSync

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

                                                                                                                                                  method mkdir

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

                                                                                                                                                    method mkdirSync

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

                                                                                                                                                      method mkdtemp

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

                                                                                                                                                        method mkdtempSync

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

                                                                                                                                                          method mountSync

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

                                                                                                                                                            method open

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

                                                                                                                                                              method opendir

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

                                                                                                                                                                method opendirSync

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

                                                                                                                                                                  method openSync

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

                                                                                                                                                                    method 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;

                                                                                                                                                                      method readdir

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

                                                                                                                                                                        method readdirSync

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

                                                                                                                                                                          method readFile

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

                                                                                                                                                                            method readFileSync

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

                                                                                                                                                                                method readlinkSync

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

                                                                                                                                                                                  method readSync

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

                                                                                                                                                                                    method readv

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

                                                                                                                                                                                      method readvSync

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

                                                                                                                                                                                        method realpath

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

                                                                                                                                                                                          method realpathSync

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

                                                                                                                                                                                            method rename

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

                                                                                                                                                                                              method renameSync

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

                                                                                                                                                                                                method reset

                                                                                                                                                                                                reset: () => void;
                                                                                                                                                                                                  resolveSymlinks: (link: Link) => Link | null;

                                                                                                                                                                                                    method rm

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

                                                                                                                                                                                                      method rmdir

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

                                                                                                                                                                                                        method rmdirSync

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

                                                                                                                                                                                                          method rmSync

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

                                                                                                                                                                                                            method stat

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

                                                                                                                                                                                                              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>;
                                                                                                                                                                                                              };
                                                                                                                                                                                                                symlink: {
                                                                                                                                                                                                                (target: PathLike, path: PathLike, callback: TCallback<void>): any;
                                                                                                                                                                                                                (target: any, path: any, type: symlink.Type, callback: TCallback<void>): any;
                                                                                                                                                                                                                };

                                                                                                                                                                                                                  method symlinkSync

                                                                                                                                                                                                                  symlinkSync: (target: PathLike, path: PathLike, type?: symlink.Type) => void;

                                                                                                                                                                                                                    method toJSON

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

                                                                                                                                                                                                                      method toTree

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

                                                                                                                                                                                                                        method truncate

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

                                                                                                                                                                                                                          method 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: TCallback<void>) => void;

                                                                                                                                                                                                                            method unlinkSync

                                                                                                                                                                                                                            unlinkSync: (path: PathLike) => void;

                                                                                                                                                                                                                              method unwatchFile

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

                                                                                                                                                                                                                                method utimes

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

                                                                                                                                                                                                                                  method utimesSync

                                                                                                                                                                                                                                  utimesSync: (path: PathLike, atime: TTime, mtime: TTime) => 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;
                                                                                                                                                                                                                                      };

                                                                                                                                                                                                                                        method write

                                                                                                                                                                                                                                        write: {
                                                                                                                                                                                                                                        (
                                                                                                                                                                                                                                        fd: number,
                                                                                                                                                                                                                                        buffer: Buffer | ArrayBufferView | DataView,
                                                                                                                                                                                                                                        callback: (...args: any[]) => void
                                                                                                                                                                                                                                        ): any;
                                                                                                                                                                                                                                        (
                                                                                                                                                                                                                                        fd: number,
                                                                                                                                                                                                                                        buffer: any,
                                                                                                                                                                                                                                        offset: number,
                                                                                                                                                                                                                                        callback: (...args: any[]) => void
                                                                                                                                                                                                                                        ): any;
                                                                                                                                                                                                                                        (
                                                                                                                                                                                                                                        fd: number,
                                                                                                                                                                                                                                        buffer: any,
                                                                                                                                                                                                                                        offset: number,
                                                                                                                                                                                                                                        length: number,
                                                                                                                                                                                                                                        callback: (...args: any[]) => void
                                                                                                                                                                                                                                        ): any;
                                                                                                                                                                                                                                        (
                                                                                                                                                                                                                                        fd: number,
                                                                                                                                                                                                                                        buffer: any,
                                                                                                                                                                                                                                        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;
                                                                                                                                                                                                                                        };

                                                                                                                                                                                                                                          method writeFile

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

                                                                                                                                                                                                                                            method writeFileSync

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

                                                                                                                                                                                                                                              method writeSync

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

                                                                                                                                                                                                                                                method writev

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

                                                                                                                                                                                                                                                  method writevSync

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

                                                                                                                                                                                                                                                    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 (2)

                                                                                                                                                                                                                                                                                Dependencies (4)

                                                                                                                                                                                                                                                                                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>