ZIP files(files with .zip extension) are well known file format used for file compression. After compression, file size  can be significantly reduced and multiple files and folder can be archive into a single zip file.  All zip files can be password protected to reduce risk of unauthorized access. Almost every operating system comes with built-in support of zip/unzip functionality. So you don’t need any third party application for archiving. If you are developer and you want to add zip/unzip feature in your application then you need to use available library in your application. PHP has native support for zip/unzip functionality. You can enable/disable this library from php.ini file. With Dot.Net application developer can use DotNetZip library which is free available, robust and well maintained. DotNetZip library can be used with any .NET  language. DotNetZip also support mobile  devices that use the .NET Compact Framework.

In short here are few good feature DotNetZip library support

  1. DotNetZip library bundled as a single DLL file size so far 400K so footprint is very small.
  2. Ability to create/read self-extracting executable zip file.
  3. Generated zip file compatible with other application like winzip, winrar and programming language such  as PHP, Java.
  4. Supoort ZIP64 which allow up to 65535 entries in a zip archive, and entry sizes up to 4.2g.
  5. Support AES 128 or 256 encryption.
  6. Support reading/writing encrypted or password protected zip files.
  7. Support Unicode filenames and comments.
  8. Support dynamic removal of entries from zip files, or updating of entries in zip files.

Here is an example of VB.Net for extracting all files.
[vbnet] Dim MyZipFile As String = ""  
Dim DestinatioDir As String = "MYZIP"  
Console.WriteLine("Extracting content of zip file {0} to {1}", MyZipFile, DestinatioDir)   
Using zip1 As ZipFile = ZipFile.Read(MyZipFile)   
AddHandler zip1.ExtractProgress, AddressOf MyExtractProgress   
Dim e As ZipEntry   
‘ Extract each entry here
For Each e In zip1   
e.Extract(DestinatioDir, ExtractExistingFileAction.OverwriteSilently)   
End Using

Written by Bala Krishna

Bala Krishna is web developer and occasional blogger from Bhopal, MP, India. He like to share idea, issue he face while working with the code.

This article has 1 comments

  1. file extension library

    What a great find I have in your article as I was browsing the net. This is really cool and it helps me solve my problem. Thank you so much for sharing it to us.