API · Consume

toNodeStream()

Expose Exstream output through a Node-compatible Transform stream.

Signature

toNodeStream(options?: object): NodeTransformLike<unknown, T>

Example

const readable = exstream(rows).jsonlStringify().toNodeStream()
readable.pipe(process.stdout)

Parameters

options

Type Node Transform optionsDefault runtime defaults

Forwarded to the platform transform factory, including object mode and high-water-mark options.

Behavior

The returned object is both readable and writable. Exstream output is piped into it with Node backpressure: a false write pauses upstream until drain. Node stream completion and destruction are connected to the Exstream branch. Input written to the returned transform follows the runtime transform’s pass-through behavior.

Runtime and errors

Available only in the Node entry/runtime. Browser usage throws toNodeStream() is not available in this runtime; use toWebReadable() there. Record errors are emitted through the Node stream error channel. Handle 'error' or use pipeTo() when a completion promise is preferable.

Forms

stream.toNodeStream({ objectMode: true })
exstream.toNodeStream({ objectMode: true }, stream)
exstream.toNodeStream({ objectMode: true })(stream)

toWebReadable(), pipe(), pipeTo()