Skip to content

createStream

createStream<T, V>(streamFunction, streamValueMutator?, options?): Promise<AsyncStreamProxy<V>>

Defined in: sdks/js/node-sdk/src/utils/streams.ts:95

Creates a stream from a stream function

If the stream fails, an attempt will be made to restart it.

Ending the stream is terminal: no callbacks are invoked and no native stream is created after the stream ends.

This function is not intended to be used directly.

T = unknown

V = T

StreamFunction<T>

The stream function to create a stream from

StreamValueMutator<T, V | undefined>

An optional function to mutate the value emitted from the stream

StreamOptions<T, V>

The options for the stream

Promise<AsyncStreamProxy<V>>

An async iterable stream proxy

if the retryAttempts option is less than 0 and retryOnFail is true

if the stream fails and can’t be restarted