Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/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

ParameterTypeDescription
filePathstringThe relative or absolute path to the file whose contents should be read.
optionsIFileSystemReadFileOptions(Optional) Optional settings that can change the behavior. Type: IReadFileOptions

Returns:

string