7

I have zip file and I want to know which library can handle it? Is there built-in method in the.netframework can unzip zip file?

user496949
  • 79,431
  • 144
  • 301
  • 419

5 Answers5

8

SharpZipLib is a good choice to use with ZIP files in .NET.

See https://github.com/icsharpcode/SharpZipLib or http://icsharpcode.github.io/SharpZipLib/ for more information.

Eugen
  • 500
  • 6
  • 14
Pieter van Ginkel
  • 28,744
  • 8
  • 70
  • 108
  • I've used this in a few projects and had no problems. Simple and straightfoward. As an aside, it's GPL I think. – kmarks2 Nov 12 '10 at 16:12
  • +1 Works perfectly! Here the link to the simplest example http://wiki.sharpdevelop.net/SharpZipLib_FastZip.ashx – kiewic Jul 02 '11 at 16:31
4

You can use the System.IO.Compression.DeflateStream class to unzip your file. There's an example there, too.

  • -1 decompressing a stream is not the same as unpacking a zip archive. From the documentation you linked: *"This class does not inherently provide functionality for adding files to or extracting files from .zip archives."* – Wim Coenen Nov 12 '10 at 15:22
  • -1 ZIP is a collection of files, like .tar.gz in unix is, not just a stream like a .gz. – Pieter van Ginkel Nov 12 '10 at 16:17
4

Use either GZipStream or DeflateStream in System.IO.Compression.

http://msdn.microsoft.com/en-us/library/system.io.compression.deflatestream.aspx

http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx

GZipStream is similar to DeflateStream, but contains a few extra bits to make it friendly with applications like WinZip.

Alex Humphrey
  • 5,963
  • 3
  • 23
  • 40
3

Have a look at DotNetZip, created by Cheeso. See also this other answer.

Community
  • 1
  • 1
Wim Coenen
  • 64,994
  • 13
  • 151
  • 241
1

Take a look at this: Free compression library for C# which supports 7zip (LZMA)

Community
  • 1
  • 1
Ricardo Nolde
  • 31,284
  • 3
  • 34
  • 37