readFile

abstract fun readFile(path: Value): JsPromise<StringOrBuffer>

Method: fs.readFile

Reads the contents of a file at the specified path; provides the results or an error to the callback. This variant accepts a polyglot Value.

Return

A promise which resolves with the file contents or rejects with an error.

Parameters

path

The path to the file to read.


abstract fun readFile(path: Value, options: Value?): JsPromise<StringOrBuffer>
abstract fun readFile(path: Path, options: ReadFileOptions? = null): JsPromise<StringOrBuffer>

Method: fs.readFile

Reads the contents of a file at the specified path; provides the results or an error to the callback. This variant accepts a polyglot Value.

Return

A promise which resolves with the file contents or rejects with an error.

Parameters

path

The path to the file to read.

options

The options to use for the file read operation.