Function readFile

  • Reads a file and returns the file's contents.

    Identical to

    Parameters

    • filepath: string

      The path to the file.

    • Optional encoding: BufferEncoding

      The encoding to use when reading the file. Note that 'undefined' defaults to 'utf8'.

    Returns Promise<string>

    See

    fs.promises.readFile, except that it uses 'utf8' encoding by default.

  • Reads a file and returns the file's contents.

    Identical to

    Parameters

    • filepath: string

      The path to the file.

    • Optional encoding: BufferEncoding

      The encoding to use when reading the file. Note that 'undefined' defaults to 'utf8'.

    • Optional callback: ((err, data) => void)

      An optional async callback.

        • (err, data): void
        • Parameters

          • err: null | ErrnoException
          • data: string

          Returns void

    Returns void

    See

    fs.readFile (with callback), except that it uses 'utf8' encoding by default.

Generated using TypeDoc