fs.read(fd, buffer, offset, length, position, callback)


从由 fd 指定的文件中读取数据。

🌐 Read data from the file specified by fd.

回调函数会接收三个参数,(err, bytesRead, buffer)

🌐 The callback is given the three arguments, (err, bytesRead, buffer).

如果文件没有被同时修改,当读取的字节数为零时,就到达了文件末尾。

🌐 If the file is not modified concurrently, the end-of-file is reached when the number of bytes read is zero.

如果以其 util.promisify()ed 版本调用此方法,它会返回一个包含 bytesReadbuffer 属性的 Object 的 Promise。

🌐 If this method is invoked as its util.promisify()ed version, it returns a promise for an Object with bytesRead and buffer properties.