What is DotNetZip All About?

The System.IO.Compression namespace added in the Microsoft .NET Framework {v2.0 v3.0 v3.5} includes base class libraries supporting compression within streams - both the Deflate (ietf rfc-1951) and Gzip (ietf rfc-1952) compression formats are supported, in the DeflateStream and GZipStream classes, respectively.

But the System.IO.Compression namespace provides streaming compression only - useful for compressing a single stream or block of bytes, but not directly useful for creating compressed archives, like .zip files or .gzip files. The compressed archives, in addition to containing the compressed stream (or file) data, also include header information, what might be called "metadata". For .zip files, the format is defined by PKWare Inc; For gzip, the format is described in RFC-1952. But the System.IO.Compression.DeflateStream class does not parse the metadata for such files. The classes in the System.IO.Compression namespace do not directly support formatting zip or gzip archive headers and so on.

As a result, if you build an application with the .NET Framework, and you want to manipulate .ZIP files, you will need an external library to do so.

This class library provides the handling for Zip files that the .NET Framework base class library lacks. Using this library, you can build .NET applications that read and write zip-format files. The library relies on the System.IO.Compression.DeflateStream class, to perform compression. Around that capability, the library adds logic for formatting zip headers, doing encryption and decryption, verifying zip contents, managing zip entries in an archive, and so on.

Why Another Library?

There are various Zip class libraries available for .NET applications. For example,

DotNetZip is an alternative to all of these options. It is open source, though not GPL licensed. It is free of cost, though donations are encouraged. It is small and simple, but it does what you need. It does not require J#. Unlike the System.Packaging classes, DotNetZip is designed specifically for .ZIP files and is easier to use because of that. (It does require .NET 2.0 for the DeflateStream class).

This code is released under the Microsoft Public License. See the License.txt for details.

Features:
  1. read, write, and update .zip files.
  2. read zips from streams or files, write zips to streams or files.
  3. extract zip entries to stream. Add entries from a stream.
  4. comments on zip entries as well as the entire zip archive
  5. progress events for Save and Extract operations.
  6. support for double-byte chars (UTF-8, or any code page) in filenames
  7. can generate self-extracting archives.
  8. ZIP64 for large (>4.2g) archives

Bugs:
  1. does not do 0..9 compression levels (not supported by the DeflateStream class)
  2. does only PKZIP encryption, which is weak. No Strong Encryption. Yet?
  3. does not do "full archive" password protection - where the central directory itself is encrypted.
  4. no support for reading or writing multi-disk zip archives
  5. no support for asynchronous operation

DotNetZip does .zip files, not .gz files

If you want code to handle .gz files, see http://blogs.msdn.com/bclteam/archive/2005/06/15/429542.aspx