Reads a file and returns its content as a string.

This function reads the entire content of a file at the specified path and returns it as a string. It does not require an open file stream, making it suitable for simple read operations.

Thrown if the environment is not a Node.js server.

Thrown if the file to read does not exist.

Thrown if any unexpected error occurs while reading the file.

  • Parameters

    • filePath: string

      The path to the file to read.

    Returns Promise<string>

    A promise that resolves to the file content as a string.