| Crates.io | zippity |
| lib.rs | zippity |
| version | 0.3.0 |
| created_at | 2024-07-28 20:42:45.106889+00 |
| updated_at | 2024-10-07 12:27:05.17979+00 |
| description | Library for asynchronously creating a ZIP file on the fly. |
| homepage | |
| repository | https://github.com/bluecube/zippity |
| max_upload_size | |
| id | 1318238 |
| size | 213,698 |
Library for asynchronously creating a ZIP file on the fly.
[tokio::io::AsyncRead])[tokio::io::AsyncSeek])[Reader::into_responder()])These are not planned to be implemented.
use std::io::SeekFrom;
use tokio::io::{AsyncSeekExt, AsyncWriteExt, copy, sink};
tokio_test::block_on(async {
// Create the builder
let mut builder = zippity::Builder::<&[u8]>::new();
// Add data
builder.add_entry("Entry name".to_owned(), b"Entry data".as_slice()).await.unwrap();
// Build the reader object
// Note that this does not touch the data yet.
let mut zippity = builder.build();
// Getting file size is in O(1)
println!("Total zip file size will be {}B", zippity.size());
// Seek to last 10B
zippity.seek(SeekFrom::End(-10)).await.unwrap();
// Write to output (in this case a sink, throwing it away)
copy(&mut zippity, &mut sink()).await.unwrap();
})
Consider this a beta version. The library is mostly finished, with lot of polish missing for version 1.0.0.
| Name | Description | Default |
|---|---|---|
tokio-file |
Adds support for TokioFileEntry being used as a entry data through Tokio file. |
yes |
bytes |
Implement EntryData for bytes::Bytes, and provide method into_bytes_stream() for Reader. |
no |
actix-web |
Addsactix_web::Reponder implementation to zippity::Reader |
no |
proptest |
Add module zippity::proptest, with strategies, and proptest::arbitrary::Arbitrary implementation for Reader. |
no |