StreamRead<T>
Namespace: Vercel.AI.Util
public struct StreamRead<T>One read from a ReadableStream%601.
Type parameters
| Name | Description |
|---|---|
T |
Properties
Section titled “Properties”public bool Done { readonly get; set; }The stream is exhausted.
Value: bool
HasValue
Section titled “HasValue”public bool HasValue { readonly get; set; }Whether Value was produced.
Value: bool
Reason
Section titled “Reason”public object? Reason { readonly get; set; }Failure reason. null is the JavaScript undefined error.
Value: object
Rejected
Section titled “Rejected”public bool Rejected { readonly get; set; }The stream failed.
Value: bool
public T Value { readonly get; set; }Chunk, when HasValue is true.
Value: T
Methods
Section titled “Methods”Chunk(T)
Section titled “Chunk(T)”public static StreamRead<T> Chunk(T value)A successful chunk.
Parameters
| Name | Type | Description |
|---|---|---|
value |
T |
Returns: StreamRead<T>
Complete()
Section titled “Complete()”public static StreamRead<T> Complete()A completed read.
Returns: StreamRead<T>
Fail(object?)
Section titled “Fail(object?)”public static StreamRead<T> Fail(object? reason)A failed read.
Parameters
| Name | Type | Description |
|---|---|---|
reason |
object |
Returns: StreamRead<T>
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product