end

abstract fun end()

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 stream.end() will raise an error.


abstract fun end(chunk: StringOrBufferOrAny?, encoding: Value?)

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 stream.end() will raise an error.

Parameters

chunk

The final chunk of data to write to the stream

encoding

The encoding of the chunk


abstract fun end(chunk: StringOrBufferOrAny?, encoding: Value?, callback: Value?)
abstract fun end(chunk: StringOrBufferOrAny?, encoding: Value? = null, callback: () -> Unit)

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 stream.end() will raise an error.

Parameters

chunk

The final chunk of data to write to the stream

encoding

The encoding of the chunk

callback

The callback to call once the data has been written and flushed