effect-io-ai

Package: effect
Module: Stream

Stream.toReadableStreamWith

Converts the stream to a ReadableStream using the provided services.

When to use

Use when bridging to Web Streams and you already have the Context required to run the stream outside an Effect.

Details

See https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream.

Example (Converting to a ReadableStream with services)

import { Context, Stream } from "effect"

const stream = Stream.make(1, 2, 3, 4, 5)
const readableStream = Stream.toReadableStreamWith(stream, Context.empty())

Signature

declare const toReadableStreamWith: (<A, XR>(context: Context.Context<XR>, options?: { readonly strategy?: QueuingStrategy<A> | undefined; }) => <E, R extends XR>(self: Stream<A, E, R>) => ReadableStream<A>) & (<A, E, XR, R extends XR>(self: Stream<A, E, R>, context: Context.Context<XR>, options?: { readonly strategy?: QueuingStrategy<A> | undefined; }) => ReadableStream<A>)

Source

Since v4.0.0