Jump to headingwrite<TBuffer extends ArrayBufferView>(fd: number,buffer: TBuffer,offset: number
| undefined
| null,length: number
| undefined
| null,position: number
| undefined
| null,callback: (err: ErrnoException | null,written: number,buffer: TBuffer,) => void,): voidWrite buffer to the file specified by fd.
offset determines the part of the buffer to be written, and length is
an integer specifying the number of bytes to write.
position refers to the offset from the beginning of the file where this data
should be written. If typeof position !== 'number', the data will be written
at the current position. See pwrite(2).
The callback will be given three arguments (err, bytesWritten, buffer) where bytesWritten specifies how many bytes were written from buffer.
If this method is invoked as its util.promisify() ed version, it returns
a promise for an Object with bytesWritten and buffer properties.
It is unsafe to use fs.write() multiple times on the same file without waiting
for the callback. For this scenario, createWriteStream is
recommended.
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.
Type Parameters Jump to heading
Jump to headingTBuffer extends ArrayBufferViewParameters Jump to heading
Jump to headingfd: numberJump to headingbuffer: TBufferJump to headingoffset: number
| undefined
| null = 0Jump to headinglength: number
| undefined
| null = buffer.byteLength - offsetJump to headingposition: number
| undefined
| null = 'null'Jump to headingcallback: () => voidReturn Type Jump to heading
voidJump to headingwrite<TBuffer extends ArrayBufferView>(fd: number,buffer: TBuffer,offset: number
| undefined
| null,length: number
| undefined
| null,callback: (err: ErrnoException | null,written: number,buffer: TBuffer,) => void,): voidAsynchronously writes buffer to the file referenced by the supplied file descriptor.
Type Parameters Jump to heading
Jump to headingTBuffer extends ArrayBufferViewParameters Jump to heading
Jump to headingfd: numberA file descriptor.
Jump to headingbuffer: TBufferJump to headingoffset: number
| undefined
| nullThe part of the buffer to be written. If not supplied, defaults to 0.
Jump to headinglength: number
| undefined
| nullThe number of bytes to write. If not supplied, defaults to buffer.length - offset.
Jump to headingcallback: () => voidReturn Type Jump to heading
voidJump to headingwrite<TBuffer extends ArrayBufferView>(fd: number,buffer: TBuffer,offset: number
| undefined
| null,callback: (err: ErrnoException | null,written: number,buffer: TBuffer,) => void,): voidAsynchronously writes buffer to the file referenced by the supplied file descriptor.
Type Parameters Jump to heading
Jump to headingTBuffer extends ArrayBufferViewParameters Jump to heading
Jump to headingfd: numberA file descriptor.
Jump to headingbuffer: TBufferJump to headingoffset: number
| undefined
| nullThe part of the buffer to be written. If not supplied, defaults to 0.
Jump to headingcallback: () => voidReturn Type Jump to heading
voidJump to headingwrite<TBuffer extends ArrayBufferView>(fd: number,buffer: TBuffer,callback: (err: ErrnoException | null,written: number,buffer: TBuffer,) => void,): voidAsynchronously writes buffer to the file referenced by the supplied file descriptor.
Type Parameters Jump to heading
Jump to headingTBuffer extends ArrayBufferViewParameters Jump to heading
Jump to headingfd: numberA file descriptor.
Jump to headingbuffer: TBufferJump to headingcallback: () => voidReturn Type Jump to heading
voidJump to headingwrite(fd: number,string: string,position: number
| undefined
| null,encoding: BufferEncoding
| undefined
| null,callback: (err: ErrnoException | null,written: number,str: string,) => void,): voidAsynchronously writes string to the file referenced by the supplied file descriptor.
Parameters Jump to heading
Jump to headingfd: numberA file descriptor.
Jump to headingstring: stringA string to write.
Jump to headingposition: number
| undefined
| nullThe offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
Jump to headingencoding: BufferEncoding
| undefined
| nullThe expected string encoding.
Jump to headingcallback: (err: ErrnoException | null,written: number,str: string,) => voidReturn Type Jump to heading
voidJump to headingwrite(fd: number,string: string,position: number
| undefined
| null,callback: (err: ErrnoException | null,written: number,str: string,) => void,): voidAsynchronously writes string to the file referenced by the supplied file descriptor.
Parameters Jump to heading
Jump to headingfd: numberA file descriptor.
Jump to headingstring: stringA string to write.
Jump to headingposition: number
| undefined
| nullThe offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
Jump to headingcallback: (err: ErrnoException | null,written: number,str: string,) => voidReturn Type Jump to heading
voidJump to headingwrite(fd: number,string: string,callback: (err: ErrnoException | null,written: number,str: string,) => void,): voidAsynchronously writes string to the file referenced by the supplied file descriptor.
Parameters Jump to heading
Jump to headingfd: numberA file descriptor.
Jump to headingstring: stringA string to write.
Jump to headingcallback: (err: ErrnoException | null,written: number,str: string,) => voidReturn Type Jump to heading
void