Options
All
  • Public
  • Public/Protected
  • All
Menu

Module fs

Wrappers for the fs module.

Also has a few utility functions

Index

Variables

Const appendFile

appendFile: __promisify__ = promisify(fs_.appendFile)

Const mkdir

mkdir: __promisify__ = promisify(fs_.mkdir)

Const mkdtemp

mkdtemp: __promisify__ = promisify(fs_.mkdtemp)

Const readFile

readFile: __promisify__ = promisify(fs_.readFile)

Const readdir

readdir: __promisify__ = promisify(fs_.readdir)

Const readlink

readlink: __promisify__ = promisify(fs_.readlink)

Const rename

rename: __promisify__ = promisify(fs_.rename)

Const stat

stat: __promisify__ = promisify(fs_.stat)

Const unlink

unlink: __promisify__ = promisify(fs_.unlink)

Const writeFile

writeFile: __promisify__ = promisify(fs_.writeFile)

Functions

copyFile

  • copyFile(inpath: string, outpath: string): Promise<void>
  • Copy a file from one location to another.

    Parameters

    • inpath: string

      The input file

    • outpath: string

      The output file

    Returns Promise<void>

exists

  • exists(fspath: string): Promise<boolean>
  • Parameters

    • fspath: string

    Returns Promise<boolean>

hardLinkFile

  • hardLinkFile(inPath: string, outPath: string): Promise<void>
  • Create a hard link of an existing file

    Parameters

    • inPath: string

      The existing file path

    • outPath: string

      The new path to the hard link

    Returns Promise<void>

mkdir_p

  • mkdir_p(fspath: string): Promise<void>
  • Creates a directory and all parent directories recursively. If the file already exists, and is not a directory, just return.

    Parameters

    • fspath: string

      The directory to create

    Returns Promise<void>

rmdir

  • rmdir(dirpath: string): Promise<void>
  • Remove a directory recursively. DANGER DANGER!

    Parameters

    • dirpath: string

      Directory to remove

    Returns Promise<void>

tryStat

  • tryStat(filePath: fs_.PathLike): Promise<Stats | null>
  • Try and stat() a file. If stat() fails for any reason, returns null.

    Parameters

    • filePath: fs_.PathLike

      The file to try and stat()

    Returns Promise<Stats | null>

Generated using TypeDoc