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


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

回调被赋予三个参数,(err, bytesRead, buffer)

如果未同时修改文件,当读取的字节数为零时,则到达文件末尾。

如果此方法作为其 util.promisify() 版本被调用,则返回具有 bytesReadbuffer 属性的 Object 的 promise。

Read data from the file specified by fd.

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.

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