Table of Contents

Class StreamResponse

Namespace
Olve.TypeSpec
Assembly
Olve.TypeSpec.dll

Writes a generated response variant's binary body (bytes with a non-JSON content type) by copying content to the response as it is read, so large files are never buffered. The stream is disposed once written, or when the response is if writing never starts. A declared Content-Length header sets the length.

public sealed class StreamResponse : IResult, IAsyncDisposable
Inheritance
StreamResponse
Implements
Inherited Members

Constructors

StreamResponse(Stream, string, int)

Writes a generated response variant's binary body (bytes with a non-JSON content type) by copying content to the response as it is read, so large files are never buffered. The stream is disposed once written, or when the response is if writing never starts. A declared Content-Length header sets the length.

public StreamResponse(Stream content, string contentType, int status)

Parameters

content Stream
contentType string
status int

Methods

DisposeAsync()

Disposes the stream, once.

public ValueTask DisposeAsync()

Returns

ValueTask

ExecuteAsync(HttpContext)

Write an HTTP response reflecting the result.

public Task ExecuteAsync(HttpContext httpContext)

Parameters

httpContext HttpContext

The HttpContext for the current request.

Returns

Task

A task that represents the asynchronous execute operation.