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.
Throws
Thrown if the environment is not a Node.js server.
Throws
Thrown if the file to read does not exist.
Throws
Thrown if any unexpected error occurs while reading the file.
readFileStream(filePath): Promise<string>
Parameters
filePath: string
The path to the file to read.
Returns Promise<string>
A promise that resolves to the file content as a string.
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.
Throws
Thrown if the environment is not a Node.js server.
Throws
Thrown if the file to read does not exist.
Throws
Thrown if any unexpected error occurs while reading the file.