API · Interop
toWebReadable()
Expose Exstream output as a pull-based Web `ReadableStream`.
Example
const body = exstream(rows).jsonlStringify().toWebReadable()
return new Response(body, { headers: { 'content-type': 'application/x-ndjson' } }) Parameters
signalAborts the underlying async iterator and Exstream branch.
strategyPassed as the native ReadableStream queuing strategy.
Demand and lifecycle
Each native pull() requests one value through Exstream’s async iterator, so reader demand controls upstream work. Normal Exstream end closes the readable. A record or fatal error errors the native stream. Reader cancellation without a reason destroys the iterator cleanly; cancellation with a reason aborts the Exstream graph with that reason.
The method requires a global ReadableStream constructor and otherwise throws. It works in modern browsers and compatible Node runtimes.
toWebReadable() is an instance-only adapter.
Signature
interface ToWebReadableOptions {
signal?: AbortSignal
strategy?: QueuingStrategy<unknown>
}
toWebReadable(options?: ToWebReadableOptions | null): ReadableStream<T>