File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed
src/Particular.LicensingComponent/WebApi Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,9 @@ public async Task GetThroughputReportFile([FromQuery(Name = "spVersion")] string
6868 FileName = $ "{ fileName } .zip"
6969 } . ToString ( ) ;
7070
71+ // The zip archive is written directly to the response body stream and has to remain open until the response is fully sent.
72+ // This is done for performance reasons to avoid buffering the entire report in memory before sending it.
73+ // The BodyWriter is used as a stream to avoid into synchronous IO operations that would be prevented by the ASP.NET Core pipeline.
7174 using var archive = new ZipArchive ( Response . BodyWriter . AsStream ( ) , ZipArchiveMode . Create , leaveOpen : true ) ;
7275 var entry = archive . CreateEntry ( $ "{ fileName } .json") ;
7376 await using var entryStream = entry . Open ( ) ;
You can’t perform that action at this time.
0 commit comments