Xceed Zip Compression Library Documentation
Brief introduction to the zip file format
Xceed Zip control reference > Brief introduction to the zip file format

A zip file is a single file that contains one or more compressed files. Zip files usually have the ".ZIP" filename extension, which helps to clearly identify them.

Each file in a zip file is stored either as compressed data or as raw uncompressed data, and can be encrypted or not encrypted. The zip file format is designed to support more than one type of compression method, so that new and improved compression methods can be used. For a zip file to be 100% PKZIP 2.04g and WinZip 1.0 to 8.0 compatible, only the Deflate compression method can be used. As of Xceed Zip v4.5, developers can choose to compress data using the BWT compression method, and as of Xceed Zip v5.0, developers can also choose to compress using the Deflate64 compression method, also known as Enhanced Deflate. Deflate64  is supported by PKZIP v4.5 and up only.

The zip file format is extensible in other ways too. New types of information about a file can be stored in it while still remaining compatible with existing unzipping applications. For example, as of Xceed Zip v4.0, the library can store and retrieve Windows NT/2000/XP file attributes and permissions, the file's UNICODE filename and other file information which is not usually found in zip files.

Structurally, a zip file consists of one or more sections, each containing a file header followed by a file's compressed or raw uncompressed data. The file headers contain information such as the file's filename, file attributes and size. Following these sections is a compact "central directory" section, which contains (mostly redundant) information about each file stored in the zip file. This central directory is very useful for quickly determining what the contents of the zip file are, because it eliminates the need to scan through the entire zip file in order to find the file headers. At the very end of the zip file, an optional "zip comment" section can be provided and can be as large as 64K.

The zip format also supports spanned zip files . For spanned zip files, the central directory section is located on the last disk, unless it is a very large zip file, in which case the central directory may be located on the last two or more disks. Reading the central directory is usually the first step an unzipping application takes in order to unzip a file, which explains why the last disk is usually requested first when unzipping files.

Xceed Zip Compression Library also allows you to create spanned zip files that are not located on different removable-media disks. Because these parts of the zip file are located in the same place, they must have different file names (the first part of the zip file is named ".zip", the second one is named ".z01", the third is named ".z02" and so on.) It is important to note that most currently available unzipping applications (except those that use Xceed Zip v4.0 and up as their zip/unzip engine) cannot unzip spanned zip files that are in the same location until each part of the zip file is placed on separate removable media disks and renamed to ".zip".

There are two major zip file formats currently in existence. The PKZIP 2.04g zip file format, which has been around since before 1994, and the PKZIP 4.5 zip file format, which was introduced in 2002. Zip files conforming to the PKZIP 2.04g zip file format can contain up to 65535 files, with a maximum size of 4 gigabytes total and up to 4 gigabytes per file in the zip file. The PKZIP 4.5 zip file format can contain trillions of gigabytes of data and a virtually unlimited amount of files (approx. 2^64 files and 2^64 bytes per file). As of Xceed Zip v5.0, both these zip file formats are fully supported.