I need to serve some data from my database in a zip file, streaming it on the fly such that:
I know that I can do streaming generation of zip files to the filesystemk using ZipOutputStream
as here. I also know that I can do streaming output from a rails controller by setting response_body
to a Proc
as here. What I need (I think) is a way of plugging those two things together. Can I make rails serve a response from a ZipOutputStream
? Can I get ZipOutputStream
give me incremental chunks of data that I can feed into my response_body
Proc
? Or is there another way?