sharpziplib - can you add a file without it copying the entire zip first?
Posted
by schmoopy
on Stack Overflow
See other posts from Stack Overflow
or by schmoopy
Published on 2010-06-07T04:31:04Z
Indexed on
2010/06/07
4:42 UTC
Read the original article
Hit count: 224
Im trying to add an existing file to a .zip file using sharpziplib - problem is, the zip file is 1GB in size. When i try to add 1 small file (400k) sharpziplib creates a copy/temp of the orig zip file before adding the new file - this poses a problem when the amount of free disk space is less than 2x the zip file you are trying to update.
for example: 1GB zip myfile.zip 1GB zip myfile.zip.tmp.293
ZipFile zf = new ZipFile(path);
zf.BeginUpdate();
zf.Add(file); // Adding a 400k file here causes a 1GB temp file to be created
zf.EndUpdate();
zf.Close();
Is there a more efficient way to do this?
Thanks :-)
© Stack Overflow or respective owner