Save space using System.Zip

Historically, Delphi contains the TZCompressionStream and the TZDecompressionStream to respectively compress and decompress streams of bytes using the zlib format. These classes are quite useful but are quite low level, being simply a stream compressor. In this recipe, we'll use a high-level class to compress and decompress folders and files. It is quite limited in terms of possibilities (you can compress and decompress files and folders, nothing more) but is very simple to use. Just keep in mind that this class is very specialized, so if you need some compression library to work with network protocols or on the fly compression/decompression, don't use this. But if you need a no-brain solution to compress something, ...

Get Delphi Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.