Reads a file and returns a promise that resolves with the file's contents.
The path of the file to read.
A promise that resolves with the file's contents.
const fileContents = await readFile('/path/to/file.txt'); Copy
const fileContents = await readFile('/path/to/file.txt');
Use readFile(path, 'utf8') from node:fs/promises, which this calls. Will be removed in goldies 6.0.
readFile(path, 'utf8')
node:fs/promises
Reads a file and returns a promise that resolves with the file's contents.