destroy

abstract override fun destroy()

Destroy the stream. Optionally emit an 'error' event, and emit a 'close' event (unless emitClose is set to false).

After this call, the writable stream has ended and subsequent calls to write() or end() will result in an ERR_STREAM_DESTROYED error. This is a destructive and immediate way to destroy a stream. Previous calls to write() may not have drained, and may trigger an ERR_STREAM_DESTROYED error.

Use end() instead of destroy if data should flush before close, or wait for the 'drain' event before destroying the stream.


abstract override fun destroy(error: Value)
abstract override fun destroy(error: Throwable)

Destroy the stream. Optionally emit an 'error' event, and emit a 'close' event (unless emitClose is set to false).

After this call, the writable stream has ended and subsequent calls to write() or end() will result in an ERR_STREAM_DESTROYED error. This is a destructive and immediate way to destroy a stream. Previous calls to write() may not have drained, and may trigger an ERR_STREAM_DESTROYED error.

Use end() instead of destroy if data should flush before close, or wait for the 'drain' event before destroying the stream.

Parameters

error

Error to set for this destruction