async_zip_futures

Crates.ioasync_zip_futures
lib.rsasync_zip_futures
version0.0.12
sourcesrc
created_at2023-03-10 11:07:46.071095
updated_at2023-03-10 11:07:46.071095
descriptionAn asynchronous ZIP archive reading/writing crate using futures-rs.
homepagehttps://github.com/bancek/rs-async-zip-futures
repositoryhttps://github.com/bancek/rs-async-zip-futures
max_upload_size
id806362
size302,159
Luka Zakrajšek (bancek)

documentation

https://docs.rs/async_zip_futures/

README

async_zip_futures

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

An asynchronous ZIP archive reading/writing crate powered by futures-rs.

Forked from rs-async-zip. tokio was replaced with futures-rs.

Features

  • Support for Stored compression method.
  • Support for writing streams using data descriptors.
  • Initial support for ZIP64 writing.
  • Aims for reasonable specification compliance.

Installation & Basic Usage

[dependencies]
async_zip_futures = { version = "0.0.12", features = ["full"] }

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

Feature Flags

  • full - Enables all below features.
  • chrono - Enables support for parsing dates via chrono.

Writing

use async_zip_futures::{Compression, ZipEntryBuilder, write::ZipFileWriter, error::ZipError};
use futures::AsyncWriteExt;
use tokio::fs::File;
use tokio_util::compat::TokioAsyncReadCompatExt;
...

let mut file = File::create("foo.zip").await.unwrap().compat();
let mut writer = ZipFileWriter::new(&mut file);

let data = b"This is an example file.";
let builder = ZipEntryBuilder::new(String::from("bar.txt"), Compression::Stored);

let mut entry_writer = writer.write_entry_stream(builder).await.unwrap();
entry_writer.write_all(data).await.unwrap();
entry_writer.close().await.unwrap();
writer.close().await.unwrap();
Commit count: 364

cargo fmt