unshift

abstract fun unshift(chunk: Value)
abstract fun unshift(chunk: StreamChunk)

The readable.unshift() method pushes a chunk of data back into the internal buffer for the stream.

This is useful in certain cases where a stream is being consumed by a parser, which needs to "un-consume" some data that it has optimistically pulled out of the source, so that it can be processed by a different parser.

Parameters

chunk

The chunk of data to unshift.


abstract fun unshift(chunk: StreamChunk, encoding: String)

The readable.unshift() method pushes a chunk of data back into the internal buffer for the stream.

This is useful in certain cases where a stream is being consumed by a parser, which needs to "un-consume" some data that it has optimistically pulled out of the source, so that it can be processed by a different parser.

Parameters

chunk

The chunk of data to unshift.

encoding

The encoding of the chunk.