method WritableBase.prototype.end
Jump to headingWritableBase.prototype.end(cb?: () => void): this
Calling the writable.end()
method signals that no more data will be written
to the Writable
. The optional chunk
and encoding
arguments allow one
final additional chunk of data to be written immediately before closing the
stream.
Calling the write method after calling end will raise an error.
// Write 'hello, ' and then end with 'world!'.
import fs from 'node:fs';
const file = fs.createWriteStream('example.txt');
file.write('hello, ');
file.end('world!');
// Writing more now is not allowed!
Parameters Jump to heading
optional
Jump to headingcb: () => void
Return Type Jump to heading
this
Jump to headingWritableBase.prototype.end(chunk: any,cb?: () => void,): this
Parameters Jump to heading
Jump to headingchunk: any
optional
Jump to headingcb: () => void
Return Type Jump to heading
this
Jump to headingWritableBase.prototype.end(chunk: any,encoding: BufferEncoding,cb?: () => void,): this
Parameters Jump to heading
Jump to headingchunk: any
Jump to headingencoding: BufferEncoding
optional
Jump to headingcb: () => void
Return Type Jump to heading
this