Skip to main content

Crate async_deflate_zip

Crate async_deflate_zip 

Source
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.

§Public API

The main entry point is ZipWriter, which accepts per-entry metadata via EntryOptions. Individual file data is streamed through EntryWriter, obtained from ZipWriter::append_file.

§Quick Start

use async_deflate_zip::{ZipWriter, EntryOptions};
use tokio::io::AsyncWriteExt;

let mut buf = Vec::new();
let mut zip = ZipWriter::new(&mut buf);

let mut entry = zip.append_file("hello.txt", EntryOptions::file()).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.
EntryOptions
Per-entry options for appending to a ZIP archive.
EntryWriter
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.