Skip to content

ServerResponseWriter

Namespace: Vercel.AI.Util

public static class ServerResponseWriter

Writes a byte stream to a ServerResponse.

Inheritance: object

View source

WriteAsync(ServerResponse?, ReadableStream<byte[]>, int?, string?, HeaderCollection?)

Section titled “WriteAsync(ServerResponse?, ReadableStream<byte[]>, int?, string?, HeaderCollection?)”
public static Task WriteAsync(ServerResponse? response, ReadableStream<byte[]> stream, int? status = null, string? statusText = null, HeaderCollection? headers = null)

Sets status and headers, then writes <code class=“paramref”>stream</code>. A false write waits for SimulateDrain(). The response is ended even when reading the stream fails.

Parameters

Name Type Description
response ServerResponse
stream ReadableStream&lt;byte\[\]&gt;
status int?
statusText string
headers HeaderCollection

Returns: Task

View source

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