Skip to main content

async_deflate_zip/
lib.rs

1//! Streaming async ZIP archive writer with per-file deflate compression.
2//!
3//! This crate provides an asynchronous interface for creating ZIP archives
4//! from streams of data. Unlike blocking ZIP writers, entries are written
5//! incrementally — each file is compressed and written to the output as it
6//! arrives, without buffering the entire archive in memory.
7//!
8//! # Architecture
9//!
10//! The crate is organized into three modules:
11//!
12//! - [`ZipWriter`] — Streaming [`ZipWriter`] and per-entry [`EntryWriter`]
13//! - [`Compression`] — Deflate compression level (0-9) (re-exported from `flate2`)
14//!
15//! # Quick Start
16//!
17//! ```rust,no_run
18//! use async_deflate_zip::ZipWriter;
19//! use tokio::io::AsyncWriteExt;
20//!
21//! # async fn example() {
22//! let mut buf = Vec::new();
23//! let mut zip = ZipWriter::new(&mut buf);
24//!
25//! let mut entry = zip.append_file("hello.txt").await.unwrap();
26//! entry.write_all(b"Hello, World!").await.unwrap();
27//! entry.close().await.unwrap();
28//!
29//! zip.finalize().await.unwrap();
30//! # }
31//! ```
32
33mod deflate_encoder;
34mod error;
35mod header;
36mod writer;
37
38pub use error::ZipError;
39pub use flate2::Compression;
40pub use writer::DirectoryWriter;
41pub use writer::EntryWriter;
42pub use writer::ZipWriter;