Function readFileSync

  • Synchronously reads the entire contents of a file.

    Parameters

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

    Returns Buffer

    file contents

    encoding The string encoding for the file contents. Defaults to null.

    flag Defaults to 'r'.

  • Parameters

    • path: PathOrFileDescriptor
    • Optionaloptions: null | BufferEncoding | (EncodingOption & { flag?: string | undefined; })

    Returns string