buffer<Buffer> | <TypedArray> | <DataView>
offset<integer> The start position from within
bufferwhere the data to write begins.
length<integer> The number of bytes from
bufferto write. Default:
buffer.byteLength - offset
position<integer> | <null> The offset from the beginning of the file where the data from
buffershould be written. If
positionis not a
number, the data will be written at the current position. See the POSIX
pwrite(2)documentation for more detail. Default:
- Returns: <Promise>
buffer to the file.
The promise is resolved with an object containing two properties:
bytesWritten<integer> the number of bytes written
buffer<Buffer> | <TypedArray> | <DataView> a reference to the
It is unsafe to use
filehandle.write() multiple times on the same file
without waiting for the promise to be resolved (or rejected). For this
On Linux, positional writes do not 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.