Class StreamResponse
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
Methods
DisposeAsync()
Disposes the stream, once.
public ValueTask DisposeAsync()
Returns
ExecuteAsync(HttpContext)
Write an HTTP response reflecting the result.
public Task ExecuteAsync(HttpContext httpContext)
Parameters
httpContextHttpContextThe HttpContext for the current request.
Returns
- Task
A task that represents the asynchronous execute operation.