开发者

How to stream an on the fly zip file without consuming too much server memory in asp.net mvc?

开发者 https://www.devze.com 2022-12-18 20:42 出处:网络
My action is creating a large zip file (more than a gig) on the fly based on some business logic. I can output to the response stream directly in my action. This is adv开发者_如何学Cantageous becaus

My action is creating a large zip file (more than a gig) on the fly based on some business logic.

I can output to the response stream directly in my action. This is adv开发者_如何学Cantageous because I am not buffering the entire file in memory before I start streaming.

This seems to go against mvc pattern though.

Is there a way to return some type of action result without having to first buffer my entire zip file?


I would do it the way you are doing it now. Patterns are meant to be followed until they don't work, at which time you implement something that does work.

Patterns are not meant to be a noose around your neck; they are there for guidance.

0

精彩评论

暂无评论...
验证码 换一张
取 消