如果未指定编码(使用 options.encoding),则数据作为 Buffer 对象返回。 否则,数据将为字符串。

如果 options 是字符串,则它指定编码。

FileHandle 必须支持读取。

如果在文件句柄上进行了一次或多次 调用,然后进行 filehandle.readFile() 调用,则将从当前位置读取数据,直到文件末尾。 它并不总是从文件的开头读取。

Asynchronously reads the entire contents of a file.

The Promise is resolved with the contents of the file. If no encoding is specified (using options.encoding), the data is returned as a Buffer object. Otherwise, the data will be a string.

If options is a string, then it specifies the encoding.

The FileHandle has to support reading.

If one or more calls are made on a file handle and then a filehandle.readFile() call is made, the data will be read from the current position till the end of the file. It doesn't always read from the beginning of the file.