An asynchronous ZIP archive reading/writing crate.
Rust
193
490 commits
updated Oct 15, 2026
An asynchronous ZIP archive reading/writing crate.
futures's IO traits.tokio's IO traits.[dependencies]
async_zip = { version = "0.0.19", features = ["full"] }
tokio-util = { version = "0.7", features = ["compat"] } # if using tokio
A (soon to be) extensive list of examples can be found under the /examples directory.
full - Enables all below features.full-wasm - Enables all below features that are compatible with WASM.tracing - Enables support for tracing.chrono - Enables support for parsing dates via chrono.tokio - Enables support for the tokio implementation module.tokio-fs - Enables support for the tokio::fs reading module.deflate - Enables support for the Deflate compression method.bzip2 - Enables support for the bzip2 compression method.lzma - Enables support for the LZMA compression method.zstd - Enables support for the zstd compression method.xz - Enables support for the xz compression method.use futures_lite::AsyncReadExt;
use tokio::{io::BufReader, fs::File};
use tokio_util::compat::TokioAsyncReadCompatExt;
use async_zip::base::read1::seek::ZipArchiveReader;
#[tokio::main]
async fn main() -> async_zip::error::Result<()> {
let file = BufReader::new(File::open("./Archive.zip").await?).compat();
let mut archive = ZipArchiveReader::open(file).await?;
let index = archive.find(b"hello.txt")?.next().expect("has file");
let size = archive.cdrs().get(index).expect("valid cdr").uncompressed_size()?;
let mut file = archive.file(index).await?;
let mut contents = String::with_capacity(size as usize);
file.read_to_string(&mut contents).await?; // CRC32 and uncompressed size are validated here
println!("{}", contents);
Ok(())
}
use async_zip::tokio::write::ZipFileWriter;
use async_zip::{Compression, ZipEntryBuilder};
use tokio::fs::File;
...
let mut file = File::create("foo.zip").await?;
let mut writer = ZipFileWriter::with_tokio(&mut file);
let data = b"This is an example file.";
let builder = ZipEntryBuilder::new("bar.txt".into(), Compression::Deflate);
writer.write_entry_whole(builder, data).await?;
writer.close().await?;
Whilst I will be continuing to maintain this crate myself, reasonable specification compliance is a huge undertaking for a single individual. As such, contributions will always be encouraged and appreciated.
No contribution guidelines exist but additions should be developed with readability in mind, with appropriate comments, and make use of rustfmt.
Whether you're wanting to report a bug you've come across during use of this crate or are seeking general help/assistance, please utilise the issues tracker and provide as much detail as possible (eg. recreation steps).
I try to respond to issues within a reasonable timeframe.
744 followers · starred Jun 2025
1,320 followers · starred Dec 2024
671 followers · starred Nov 2025
250 followers · starred Jul 2026
An asynchronous ZIP archive reading/writing crate.
Rust
193
490 commits
updated Oct 15, 2026
An asynchronous ZIP archive reading/writing crate.
futures's IO traits.tokio's IO traits.[dependencies]
async_zip = { version = "0.0.19", features = ["full"] }
tokio-util = { version = "0.7", features = ["compat"] } # if using tokio
A (soon to be) extensive list of examples can be found under the /examples directory.
full - Enables all below features.full-wasm - Enables all below features that are compatible with WASM.tracing - Enables support for tracing.chrono - Enables support for parsing dates via chrono.tokio - Enables support for the tokio implementation module.tokio-fs - Enables support for the tokio::fs reading module.deflate - Enables support for the Deflate compression method.bzip2 - Enables support for the bzip2 compression method.lzma - Enables support for the LZMA compression method.zstd - Enables support for the zstd compression method.xz - Enables support for the xz compression method.use futures_lite::AsyncReadExt;
use tokio::{io::BufReader, fs::File};
use tokio_util::compat::TokioAsyncReadCompatExt;
use async_zip::base::read1::seek::ZipArchiveReader;
#[tokio::main]
async fn main() -> async_zip::error::Result<()> {
let file = BufReader::new(File::open("./Archive.zip").await?).compat();
let mut archive = ZipArchiveReader::open(file).await?;
let index = archive.find(b"hello.txt")?.next().expect("has file");
let size = archive.cdrs().get(index).expect("valid cdr").uncompressed_size()?;
let mut file = archive.file(index).await?;
let mut contents = String::with_capacity(size as usize);
file.read_to_string(&mut contents).await?; // CRC32 and uncompressed size are validated here
println!("{}", contents);
Ok(())
}
use async_zip::tokio::write::ZipFileWriter;
use async_zip::{Compression, ZipEntryBuilder};
use tokio::fs::File;
...
let mut file = File::create("foo.zip").await?;
let mut writer = ZipFileWriter::with_tokio(&mut file);
let data = b"This is an example file.";
let builder = ZipEntryBuilder::new("bar.txt".into(), Compression::Deflate);
writer.write_entry_whole(builder, data).await?;
writer.close().await?;
Whilst I will be continuing to maintain this crate myself, reasonable specification compliance is a huge undertaking for a single individual. As such, contributions will always be encouraged and appreciated.
No contribution guidelines exist but additions should be developed with readability in mind, with appropriate comments, and make use of rustfmt.
Whether you're wanting to report a bug you've come across during use of this crate or are seeking general help/assistance, please utilise the issues tracker and provide as much detail as possible (eg. recreation steps).
I try to respond to issues within a reasonable timeframe.
744 followers · starred Jun 2025
1,320 followers · starred Dec 2024
671 followers · starred Nov 2025
250 followers · starred Jul 2026