On the fly bundling of multiple GZipStreams into zip. #722
Unanswered
simonmacarthur
asked this question in
Q&A
Replies: 1 comment 1 reply
-
The new "precompresed entity" support (from PR #683) should help with this. I'm not sure about calculating the size though... |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
After some advice before I go off and build something from scratch.
My solution stores a number of PDF files uploaded by users up onto Azure Blob storage. These files are streamed through * the GZipStream class during upload, with the server-side file stored in compressed form. During download of such a pdf, the appropriate headers response headers are set and the browser automatically decompresses and views the files as expected.
My next task is to allow users to select multiple files and download them as a singular zip file.
Clearly I could build temporary zips easily enough, store the file, then stream the result to the browser, however it seems I have enough information to build a "virtual zip" using a combination of on-disk ".gz"s and stored data captured during initial upload (CRC, original file size, compressed file size, name), and stream this directly to the browser on-the-fly.
I'd need to calculate the total output size of the final zip stream in advance to produce the correct HTML response header length, but then stream the relevant zip local file headers, my persisted gz streams, and finally the central file headers to the output stream....
Thoughts or pointers gratefully received,
Si
Beta Was this translation helpful? Give feedback.
All reactions