Does anyone know of a good open-source zipping library for .NET?
SharpZipLib
Regarding the comments and other posts about the internal gzip implementation, they are not the same! GZip does not create the header required for archiving; it is only useful for "zipping" one file or stream.
Proper zip archives contain a header that list all compressed files and where in the compressed data they come and therefore you need something that makes a header. That means SharpZipLib, one of the many commercial versions or using something external with .NET bindings like 7zip.
Just on the offchance somebody wants to say this: "But I see .gz
files in Linux all the time!" - they're just single files and .tar.gz
is no exception - tar is the archive file. The .gz
is that archive compressed.
Couple comments.
DotNetZip is a good 3rd party option. Free, open source, actively maintained, simple to use, small, good feature set. It is shipped as a single assembly - it is fully managed code. Works on Compact Framework as well as on the regular .NET Framework. The pre-req is .NET 2.0.
DotNetZip also includes a ZLIB library, with classes like {Zlib,GZip,Deflate}Stream. They are comparable to those built-in to .NET, but they include the ability to set Compression Levels, and at higher levels they compress much more effectively than the built-in classes. The ZlibStream does RFC 1950 compression.
DotNetZip does ZIP64, passwords, AES encryption, streams, SFX, and Unicode. Everyone who uses it says it is much simpler to use than SharpZipLib. There's a good help file (.chm) and lots of code examples.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With