Example of efficiently writing an IEnumerable to a FileResult
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
Models
Pages
wwwroot
.gitignore
EnumerableFileResult.cs
EnumerableStreamFileResult.csproj
IStreamWritingAdapter.cs
LICENSE
Program.cs
README.md
Startup.cs
appsettings.Development.json
appsettings.json

README.md

EnumerableStreamFileResult

Example of efficiently writing an IEnumerable to a FileResult.

The EnumerableFileResult<T> class can be initialized with an IEnumerable<T> and when executed by the ASP.NET Core pipeline in enumerates through the enumerable and using a custom adapter, IStreamWritingAdapter<T>, writes each item to the response stream (HttpContext.Response.Body).

More details and reasoning at: http://philipm.at/2018/enumerablefilestreamer.html