Compression

Algorithms for making data smaller.

PurposeRust Crate(s)
Generalflate2 (zlib, gzip, deflate), miniz_oxide (zlib), zstd (Zstandard), lz4
Specializedbrotli (Brotli), snap (Snappy)
Archivingtar, zip

tar

flate2

RecipeCratesCategories
Compress then Decompressflate2cat-compression

zip and async-zip

The zip crate allows you to create, open, and manipulate ZIP files, including adding, extracting, and deleting files and directories within the archive. The crate supports various features of the ZIP format, such as compression (using different algorithms), encryption, and metadata handling. It offers both streaming and buffered interfaces. The zip crate is commonly used for tasks like archiving files, distributing software, and handling data compression in applications.

async-zip is a Rust crate providing asynchronous support for reading and writing ZIP archives. Building upon the foundation of the zip crate, async-zip leverages asynchronous programming paradigms (using async/await) to enable non-blocking operations on ZIP files. This is particularly beneficial in I/O-bound contexts, such as network applications or when working with large archives, as it allows other tasks to proceed while ZIP operations are in progress. It integrates with the tokio runtime (and other async runtimes). Like its synchronous counterpart, async-zip supports various ZIP features, including compression, encryption, and metadata handling, but with the added advantage of non-blocking execution.

  • Data Serialization is often used with compression: see Complex Encoding.