This project is read-only.

Reading from partially-written saved zip file

May 14, 2014 at 3:34 PM
I've got some code that makes .zip files from an amalgam of sources. It takes several minutes to .Save() the zip. I'm hoping I can use the progress to signal a reader (on a separate thread) to read chunks as they become available. What I'm concerned about is if/whether it's safe to do this. That is, does the Save process jump around in the file, making it unsafe to assume once-written chunks are transmissible on another thread?
May 15, 2014 at 4:34 PM
Don't know who cares about this, but if you do...

Turns out, if you pass a file name on the creation of the ZipFile, you can't really do what I was hoping to do...which is to begin transmitting the incrementally-written zip file as it gets built. This is because the Save method creates a temp file first, and then does a delete/rename at the end. So, I'm not saving any time, since the target file doesn't really exist until the very end.

However, if I create the ZipFile w/o arguments, and then pass a stream to the Save method, I get something even better...a stream I can compose on the server and consume on the client using the method cited here.
Marked as answer by ClayBorkholm on 5/15/2014 at 8:34 AM