Expand description
Streaming async ZIP archive writer with per-file deflate compression.
This crate provides an asynchronous interface for creating ZIP archives from streams of data. Unlike blocking ZIP writers, entries are written incrementally — each file is compressed and written to the output as it arrives, without buffering the entire archive in memory.
§Architecture
The crate is organized into three modules:
ZipWriter— StreamingZipWriterand per-entryEntryWriterCompression— Deflate compression level (0-9) (re-exported fromflate2)
§Quick Start
use async_deflate_zip::ZipWriter;
use tokio::io::AsyncWriteExt;
let mut buf = Vec::new();
let mut zip = ZipWriter::new(&mut buf);
let mut entry = zip.append_file("hello.txt").await.unwrap();
entry.write_all(b"Hello, World!").await.unwrap();
entry.close().await.unwrap();
zip.finalize().await.unwrap();Structs§
- Compression
- When compressing data, the compression level can be specified by a value in this struct.
- Directory
Writer - A handle for finalizing a directory entry in a ZIP archive.
- Entry
Writer - A streaming writer for a single file entry in a ZIP archive.
- ZipWriter
- A streaming ZIP archive writer with per-file deflate compression.
Enums§
- ZipError
- Errors that can occur when creating a ZIP archive.