API · Create
exstream()
Adapt an existing source into one lazy, backpressure-aware pipeline model.
Sources
Accepted sources are existing Exstreams, promises, synchronous and asynchronous iterables, Web ReadableStreams, Node readable streams, or no source for a manually writable stream. Existing Exstreams are returned unchanged. Source adapters preserve their natural pressure model; see Create a source for complete examples.
Options
bufferLimitMaximum queued data/error records. The end marker does not count toward this limit.
overflowError throws
BufferOverflowError. Drop policies require a finite limit and updatedropped.signalAborts the stream with the signal reason; an already-aborted signal creates an already-aborted stream.
startAutomatic mode activates from downstream demand. Manual mode keeps the root graph open for reliable fork registration until
start().
Errors and runtimes
Invalid source types throw synchronously. Iterator/read failures enter the record-error protocol with source provenance. Node stream support is selected by the Node entry; browser builds use Web streams and portable codecs. Source adapters acquire iterators and platform readers on demand. Use defer() to postpone creation of the source object itself.
Signature
exstream<T, C extends object>(source: Exstream<T, C>, options?: StreamOptions | null): Exstream<T, C>
exstream<T>(source: PromiseLike<T>, options?: StreamOptions | null): Exstream<Awaited<T>>
exstream<T>(source: Iterable<T> | AsyncIterable<T>, options?: StreamOptions | null): Exstream<T>
exstream<T>(source: ReadableStream<T> | NodeReadableLike<T>, options?: StreamOptions | null): Exstream<T>
exstream<T = unknown>(source?: null, options?: StreamOptions | null): Exstream<T>
interface StreamOptions {
bufferLimit?: number
overflow?: 'error' | 'drop-oldest' | 'drop-newest'
signal?: AbortSignal
start?: 'auto' | 'manual'
} Related
defer(), fromEvent(), write(), stream state, Create a source