Generic async iterable stream wrapper that provides abort control functionality. Allows for cancellation of streaming operations via AbortController.
const controller = new AbortController(); const stream = await Stream.createStream<MyType>(transformStream, controller); for await (const item of stream) { console.log(item); } // Later: controller.abort() to cancel ```; Copy
const controller = new AbortController(); const stream = await Stream.createStream<MyType>(transformStream, controller); for await (const item of stream) { console.log(item); } // Later: controller.abort() to cancel ```;
Type of items in the stream
Creates a new Stream instance.
Function that returns an async iterator
Controller for aborting the stream
Private
Implements the async iterator protocol for the stream.
Async iterator for the stream
Static
Creates a Stream instance from a Transform stream.
Node.js Transform stream to wrap
Promise resolving to a Stream instance
Generic async iterable stream wrapper that provides abort control functionality. Allows for cancellation of streaming operations via AbortController.
Example