filehandle.writev(buffers[, position])
buffers
<Buffer[]> | <TypedArray[]> | <DataView[]>position
<integer> 要写入来自buffers
的数据的文件的开头偏移量。 如果position
不是number
,则数据将被写入当前位置。- 返回: <Promise>
将 <ArrayBufferView> 的数组写入文件。
使用包含以下两个属性的对象来解决 promise:
bytesWritten
<integer> 写入的字节数buffers
<Buffer[]> | <TypedArray[]> | <DataView[]> 对buffers
输入的引用。
在同一文件上多次调用 writev()
而不等待 promise 被解决(或拒绝)是不安全的。
在 Linux 上,以追加模式打开文件时,位置写入不起作用。 内核会忽略位置参数,并始终将数据追加到文件末尾。
buffers
<Buffer[]> | <TypedArray[]> | <DataView[]>position
<integer> The offset from the beginning of the file where the data frombuffers
should be written. Ifposition
is not anumber
, the data will be written at the current position.- Returns: <Promise>
Write an array of <ArrayBufferView>s to the file.
The promise is resolved with an object containing a two properties:
bytesWritten
<integer> the number of bytes writtenbuffers
<Buffer[]> | <TypedArray[]> | <DataView[]> a reference to thebuffers
input.
It is unsafe to call writev()
multiple times on the same file without waiting
for the promise to be resolved (or rejected).
On Linux, positional writes don't work when the file is opened in append mode. The kernel ignores the position argument and always appends the data to the end of the file.