Skip to content

StitchableStream<T>

Namespace: Vercel.AI.Util

public sealed class StitchableStream<T>

A stream that reads inner streams one at a time.

Type parameters

Name Description
T

Inheritance: object

View source

public StitchableStream()

Creates an empty stitchable stream.

View source

public ReadableStream<T> Stream { get; }

Outer stream.

Value: ReadableStream&lt;T&gt;

View source

AddStream(ReadableStream<T>?, Action<object>?, Action?)

Section titled “AddStream(ReadableStream<T>?, Action<object>?, Action?)”
public void AddStream(ReadableStream<T>? inner, Action<object>? onError = null, Action? onCancel = null)

Queues <code class=“paramref”>inner</code> to be read after the streams already added.

Parameters

Name Type Description
inner ReadableStream&lt;T&gt;
onError Action<object>
onCancel Action

View source

public void Close()

Lets current inner streams finish, then closes the outer stream.

View source

public void Terminate()

Cancels every inner stream and closes the outer stream.

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product