Skip to content

loadFileContents

@wuespace/telestion / utils / loadFileContents

loadFileContents(file, encoding): Promise<string>

Loads the contents of a specified file.

Parameters

file: File

The file object to load contents from.

encoding: string= 'utf-8'

The encoding to use while reading the file. Default is UTF-8.

Returns

Promise<string>

  • A Promise that resolves with the contents of the file as a string. - If the file is empty, the Promise will be rejected with an error.