sharpziplib - can you add a file without it copying the entire zip first?

天涯浪子 提交于 2019-12-02 02:06:14

Found the answer:

http://community.sharpdevelop.net/forums/p/5934/17056.aspx#17056

Hi,

If you are creating a new Zip archive is might be easier to use the ZipOutputStream class instead.

If you are updating you can get the ZipFile class to write directly to the existing archive on disk if you choose. IArchiveStorage (The library supplies a DiskArchiveStorage) is the key interface passed when BeginUpdate is called. It has a UpdateMode property which can be set to Safe or Direct.

The implications are obvious hopefully. Failure during an update may corrupt the archive losing the data.

hth, -jr-

If you're creating the zip file from scratch, use ZipOutputStream instead of ZipFile. You can find an example of this in the SharpZipLib sources. I'm not sure if ZipOutputStream supports adding to an existing zip file, so if that's what you're doing I'm afraid I don't have a useful answer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!