Unit implementing zip/unzip compression/decompression functionality zipper implements zip compression/decompression compatible with the popular .ZIP format. The zip file format is documented at http://www.pkware.com/documents/casestudies/APPNOTE.TXT. The Pascal conversion of the standard zlib library was implemented by Jacques Nomssi Nzali. It is used in the FCL to implement the class. Marker specifying end of directory within zip file Marker specifying a file entry within the zip file Denotes beginning of a file header within the zip file. A file header follows this marker, followed by the file data proper. Marker specifying a file entry within the zip directory Denotes beginning of a file entry inside the zip directory. A file header follows this marker. Record structure containing local file header Signature for local file header within zip file Minimum zip version needed to extract General purpose bit flag Please see zip format documentation for details. Compression method Last modification date of file Last modification date of file CRC 32 CRC 32 value for a file, presumably containing the CRC 32 checksum of file data. Size in bytes of compressed file Size in bytes of decompressed file File name length Extra field length Length of extra field in local file header. An extra field contains program-specific information and should be ignored if the extra field is not supported. Record structure containing central file header This record contains the structure for a file header within the central directory. Central file header signature Zip version that compressed the file Zip version needed to extract file Central file general purpose bit flag General purpose flag for a file entry in the central directory. Compression method Method used to compress the file File last modification time File last modification date CRC-32 checksum Compressed size of file Uncompressed size of file Length of file name Extra field length Length of extra field (or 0 if none). An extra field contains program-specific information and should be ignored if the extra field is not supported. File comment length Length of file comment (or 0 if none). Starting disk number Internal file attributes External file attributes Relative offset of local header Record storing end of central directory information The end of central directory is placed at the end of the zip file. Note that the end of central directory record is distinct from the Zip64 end of central directory record and zip64 end of central directory locator, which precede the end of central directory, if implemented. End of central directory signature Number of this disk Number of the disk with the start of the central directory Total number of entries in the central directory in this disk Total number of entries in the central directory Size of the central directory Offset of the start of the central directory against the starting disk number Length of the zip comment field Denotes the length of the comment for the entire zip file (or 0 if no comment) Table used in calculating CRC-32 Table used in determining CRC-32 values. There are various CRC-32 algorithms in use; please refer to the ZIP file format specifications for details. Event procedure for capturing compression/decompression progress Object that sends the event Percentage completed Event procedure for an end of file (de)compression event Object that sends the event Ratio of total operation (compression/decompression) that is completed Event procedure for a start of file (de)compression event Object that sends the event File name of file to be processed Compressor object This object compresses a stream into a compressed zip stream. Input/source stream for compression Output stream with compressed data CRC calculation variable Size of buffer used for compression Percentage of operation completed Progress event procedure Updates running CRC32 value Creates a object Input file that will be compressed File for writing compressed output Buffer size used when compressing Compresses input stream to output stream Identifier for type of compression Identifier for type of compression Size of buffer used for compression Reference to OnPercent event handler Reference to OnProgress event handler Running CRC32 value Running CRC32 value used when writing zip header Decompressor object This object decompresses a compressed zip stream. Input stream with compressed data Output stream with decompressed data Running CRC32 value CRC32 value; used for checking zip file integrity Buffer size Percentage of operation completed Reference to OnProgress event handler Updates running CRC32 value Creates decompressor object Input stream with compressed data Output stream with uncompressed data Size of buffer used in decompression Decompress zip stream Identifier for type of compression Identifier for type of compression Size of buffer used in decompression Percentage of decompression completion Event handler for OnProgress procedure Running CRC32 value used for verifying zip file integrity Child of TCompressor that implements the Shrink compression method Child of TCompressor that implements the Deflate compression method Child of TDeCompressor that implements the Inflate decompression method Indication of operating system/filesystem Currently either OS_UNIX (if UNIX is defined) or OS_FAT. Files in the zip archive Adds file to zip directory Adds a file to the list of files that will be written out in the zip file. Adds a zip file entry from a stream Entries (files) in the zip archive Zips all files in object and writes zip to disk

This procedure zips up all files in the object and writes the resulting zip file to disk.

An example of using this procedure:

uses Zipper; var Zipper: TZipper; begin try Zipper := TZipper.Create; Zipper.FileName := ParamStr(1); //Use the first parameter on the command line as zip file name for I := 2 to ParamCount do //Use the other arguments on the command line as files to be zipped Zipper.Entries.AddFileEntry(ParamStr(I), ParamStr(I)); Zipper.ZipAllFiles; finally Zipper.Free; end; end.
Unzips all files in a zip file, writing them to disk

This procedure unzips all files in a object and writes the unzipped files to disk.

The example below unzips the files into "C:\windows\temp":

uses Zipper; var UnZipper: TUnZipper; begin UnZipper := TUnZipper.Create; try UnZipper.FileName := ZipFilePath; UnZipper.OutputPath := 'C:\Windows\Temp'; UnZipper.UnZipAllFiles; finally UnZipper.Free; end; end.
Unzips specified files Name of zip file to unzip Stringlist containing list of one or multiple files to be unzipped Name of zip file to unzip Removes all entries and files from object Opens zip file and reads the directory entries (list of zipped files) Callback procedure that will be called before unzipping a file Callback procedure that will be called after unzipping a file Zip file to be unzipped/processed Path where archive files will be unzipped Files in zip file (deprecated) List of files that should be compressed in the zip file. Note: deprecated. Use Entries.AddFileEntry(FileName) or Entries.AddFileEntries(List) instead. Exception specific to the zipper unit