Majored / rs-async-zip

An asynchronous ZIP archive reading/writing crate.
MIT License
123 stars 40 forks source link
archive async rust zip

async_zip

Crates.io Crates.io docs.rs GitHub Workflow Status (branch) GitHub

An asynchronous ZIP archive reading/writing crate.

Features

Installation & Basic Usage

[dependencies]
async_zip = { version = "0.0.17", features = ["full"] }

A (soon to be) extensive list of examples can be found under the /examples directory.

Feature Flags

Reading

use tokio::{io::BufReader, fs::File};
use async_zip::tokio::read::seek::ZipFileReader;
...

let mut file = BufReader::new(File::open("./Archive.zip").await?);
let mut zip = ZipFileReader::with_tokio(&mut file).await?;

let mut string = String::new();
let mut reader = zip.reader_with_entry(0).await?;
reader.read_to_string_checked(&mut string).await?;

println!("{}", string);

Writing

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?;

Contributions

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.

Issues & Support

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.