Home > @microsoft/node-core-library > FileSystem > readFile

FileSystem.readFile() method

Reads the contents of a file into a string. Behind the scenes it uses fs.readFileSync().

Signature:

static readFile(filePath: string, options?: IFileSystemReadFileOptions): string;

Parameters

Parameter Type Description
filePath string The relative or absolute path to the file whose contents should be read.
options IFileSystemReadFileOptions Optional settings that can change the behavior. Type: IReadFileOptions

Returns:

string