Variable fsConst

fs: __module & __module & {
    copy: ((src: string, dist: string, opts?: {
        overwrite?: boolean;
        skip?: ((file: string, stat: Stats) => boolean | void | Promise<boolean | void>);
    }) => Promise<void>);
    copyFile: ((src: PathLike, dst: PathLike, mode?: number) => Promise<void>) | ((src: PathLike, dist: PathLike) => Promise<unknown>);
    watchDir: {
        (dir: string, cb: WatchDirHandler): void;
        (dir: string, options: WatchDirOptions, cb: WatchDirHandler): void;
    };
    exists(path: PathLike): Promise<boolean>;
    isDirectory(path: PathLike): Promise<boolean>;
    isFile(path: PathLike): Promise<boolean>;
    isSymbolicLink(path: PathLike): Promise<boolean>;
    iter(dir: string, skip: ((path: string, stat: Stats) => boolean | void | Promise<boolean | void>)): Promise<void>;
    lexists(path: PathLike): Promise<boolean>;
    mkdirp(dir: string): Promise<void>;
    mkdirpSync(dir: string): void;
    outputFile(path: string, data: any, options?: WriteOptions): Promise<void>;
    outputFileSync(path: string, data: any, options?: WriteOptions): void;
    outputJson(path: string, data: object, options?: {
        replacer?: ((key: string, value: any) => any);
        space?: number;
    } & WriteOptions): Promise<void>;
    outputJsonSync(path: string, data: any, options?: {
        replacer?: ((key: string, value: any) => any);
        space?: number;
    } & WriteOptions): void;
    readJson<T>(path: string, options?: null | {
        encoding?: null;
        flag?: string;
    }): Promise<T>;
    readJsonSync<T>(path: string, options?: null | {
        encoding?: null;
        flag?: string;
    }): T;
    rmrf(path: string): Promise<void>;
} = ...

Type declaration

  • copy: ((src: string, dist: string, opts?: {
        overwrite?: boolean;
        skip?: ((file: string, stat: Stats) => boolean | void | Promise<boolean | void>);
    }) => Promise<void>)
      • (src, dist, opts?): Promise<void>
      • Parameters

        • src: string
        • dist: string
        • Optionalopts: {
              overwrite?: boolean;
              skip?: ((file: string, stat: Stats) => boolean | void | Promise<boolean | void>);
          }
          • Optionaloverwrite?: boolean

            overwrite if exists, default is true

          • Optionalskip?: ((file: string, stat: Stats) => boolean | void | Promise<boolean | void>)

            return true will skip

              • (file, stat): boolean | void | Promise<boolean | void>
              • Parameters

                • file: string
                • stat: Stats

                Returns boolean | void | Promise<boolean | void>

        Returns Promise<void>

  • copyFile: ((src: PathLike, dst: PathLike, mode?: number) => Promise<void>) | ((src: PathLike, dist: PathLike) => Promise<unknown>)
  • watchDir: {
        (dir: string, cb: WatchDirHandler): void;
        (dir: string, options: WatchDirOptions, cb: WatchDirHandler): void;
    }
  • exists:function
    • Parameters

      • path: PathLike

      Returns Promise<boolean>

  • isDirectory:function
    • Parameters

      • path: PathLike

      Returns Promise<boolean>

  • isFile:function
    • Parameters

      • path: PathLike

      Returns Promise<boolean>

  • isSymbolicLink:function
    • Parameters

      • path: PathLike

      Returns Promise<boolean>

  • iter:function
    • Parameters

      • dir: string
      • skip: ((path: string, stat: Stats) => boolean | void | Promise<boolean | void>)

        return true will skip

          • (path, stat): boolean | void | Promise<boolean | void>
          • Parameters

            • path: string
            • stat: Stats

            Returns boolean | void | Promise<boolean | void>

      Returns Promise<void>

  • lexists:function
    • exists via lstat, if a symbolic link's target file doesn't exists, fs.exists will return false, but fs.lexists will return true.

      Parameters

      • path: PathLike

      Returns Promise<boolean>

  • mkdirp:function
    • Make directory with parents, like mkdir -p

      Parameters

      • dir: string

      Returns Promise<void>

  • mkdirpSync:function
    • Make directory with parents, like mkdir -p

      Parameters

      • dir: string

      Returns void

  • outputFile:function
    • Parameters

      Returns Promise<void>

  • outputFileSync:function
    • Parameters

      Returns void

  • outputJson:function
    • Parameters

      • path: string
      • data: object
      • Optionaloptions: {
            replacer?: ((key: string, value: any) => any);
            space?: number;
        } & WriteOptions

      Returns Promise<void>

  • outputJsonSync:function
    • Parameters

      • path: string
      • data: any
      • Optionaloptions: {
            replacer?: ((key: string, value: any) => any);
            space?: number;
        } & WriteOptions

      Returns void

  • readJson:function
    • Type Parameters

      • T = any

      Parameters

      • path: string
      • Optionaloptions: null | {
            encoding?: null;
            flag?: string;
        }

      Returns Promise<T>

  • readJsonSync:function
    • Type Parameters

      • T = any

      Parameters

      • path: string
      • Optionaloptions: null | {
            encoding?: null;
            flag?: string;
        }

      Returns T

  • rmrf:function
    • Remove file or directory recursively, like rm -rf

      Parameters

      • path: string

        The path to remove

      Returns Promise<void>