Crates.io | async_zip_futures |
lib.rs | async_zip_futures |
version | 0.0.12 |
source | src |
created_at | 2023-03-10 11:07:46.071095 |
updated_at | 2023-03-10 11:07:46.071095 |
description | An asynchronous ZIP archive reading/writing crate using futures-rs. |
homepage | https://github.com/bancek/rs-async-zip-futures |
repository | https://github.com/bancek/rs-async-zip-futures |
max_upload_size | |
id | 806362 |
size | 302,159 |
An asynchronous ZIP archive reading/writing crate powered by futures-rs
.
Forked from rs-async-zip
. tokio
was replaced with futures-rs
.
[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.
full
- Enables all below features.chrono
- Enables support for parsing dates via chrono
.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();