Skip to content

StreamRead<T>

Namespace: Vercel.AI.Util

public struct StreamRead<T>

One read from a ReadableStream%601.

Type parameters

Name Description
T

View source

public bool Done { readonly get; set; }

The stream is exhausted.

Value: bool

View source

public bool HasValue { readonly get; set; }

Whether Value was produced.

Value: bool

View source

public object? Reason { readonly get; set; }

Failure reason. null is the JavaScript undefined error.

Value: object

View source

public bool Rejected { readonly get; set; }

The stream failed.

Value: bool

View source

public T Value { readonly get; set; }

Chunk, when HasValue is true.

Value: T

View source

public static StreamRead<T> Chunk(T value)

A successful chunk.

Parameters

Name Type Description
value T

Returns: StreamRead<T>

View source

public static StreamRead<T> Complete()

A completed read.

Returns: StreamRead<T>

View source

public static StreamRead<T> Fail(object? reason)

A failed read.

Parameters

Name Type Description
reason object

Returns: StreamRead<T>

View source

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