FileStreamResult Class

Summary

Represents an [Microsoft.AspNet.Mvc.ActionResult]() that when executed will write a file from a stream to the response.

Syntax

public class FileStreamResult : FileResult, IActionResult

GitHub

View on GitHub

class Microsoft.AspNet.Mvc.FileStreamResult

Constructors

FileStreamResult(System.IO.Stream, MediaTypeHeaderValue)

Creates a new [Microsoft.AspNet.Mvc.FileStreamResult](Microsoft.AspNet.Mvc.FileStreamResult.yml) instance with the provided <paramref name=”fileStream” /> and the provided <paramref name=”contentType” />.

Arguments:
  • fileStream (System.IO.Stream) – The stream with the file.
  • contentType (MediaTypeHeaderValue) – The Content-Type header of the response.
public FileStreamResult(Stream fileStream, MediaTypeHeaderValue contentType)
FileStreamResult(System.IO.Stream, System.String)

Creates a new [Microsoft.AspNet.Mvc.FileStreamResult](Microsoft.AspNet.Mvc.FileStreamResult.yml) instance with the provided <paramref name=”fileStream” /> and the provided <paramref name=”contentType” />.

Arguments:
  • fileStream (System.IO.Stream) – The stream with the file.
  • contentType (System.String) – The Content-Type header of the response.
public FileStreamResult(Stream fileStream, string contentType)

Properties

FileStream()

Gets or sets the stream with the file that will be sent back as the response.

Return type:System.IO.Stream
public Stream FileStream { get; set; }

Methods

WriteFileAsync(HttpResponse, System.Threading.CancellationToken)
Arguments:
  • response (HttpResponse) –
  • cancellation (System.Threading.CancellationToken) –
Return type:

System.Threading.Tasks.Task

protected override Task WriteFileAsync(HttpResponse response, CancellationToken cancellation)