liveBook · Manning

Streaming

As explained in ASP.NET Core in Action, 3e

File streaming is the technique of processing file content incrementally as it is transferred instead of storing the entire file before processing.

File streaming processes request content incrementally instead of holding the entire file in memory. In a minimal API, inject Stream to access the request body directly; PipeReader offers a higher-level alternative for similar scenarios. section 7.6.1

Choose the approach according to upload size and complexity:

  • Use IFormFile for small uploads when buffering the complete file in memory and on disk is acceptable. section 7.6.3
  • Avoid IFormFile for large uploads because buffering can exhaust memory or disk space; stream the files directly instead. section 7.6.3
  • Treat direct large-file streaming as complex and error-prone, and generate a new filename before saving user uploads. section 7.6.3

How ASP.NET Core in Action, 3e covers it

How deep it goes
Defines request-body streaming and contrasts buffering, but defers implementation details for large-file streaming.
Examples
Uses injected Stream, IFormFile, IFormFileCollection, and OpenReadStream as upload-handling examples.
What you can do after
Evaluate upload approaches and avoid buffering large files through IFormFile.
How it connects
Connects streaming with minimal APIs, request bodies, PipeReader, model binding, and file uploads.

Also explained in

Compare how 19 books explain streaming →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.