# Zippity Library for asynchronously creating a ZIP file on the fly. ## Features - [x] Async, using tokio. - [x] ZIP is created on the fly, can be directly streamed somewhere, does not need to be stored in RAM or on disk - [x] Supports Zip64 (files > 4GB). - [x] File size is known in advance - [x] Output is driven from outside (implements `[tokio::io::AsyncRead]`) - [x] Allows seeking in the file (implements `[tokio::io::AsyncSeek]`) - [X] Supports files on the filesystem as entries. - [ ] Supports tokio_uring - [X] Supports integration with Actix Web (see `[Reader::into_responder()]`) - [ ] Entry metadata ## Non-features These are not planned to be implemented. - Compression: The zip only uses store method. - Encryption - Zip reading ## Example ```rust 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(); }) ``` ## Current state Consider this a beta version. The library is mostly finished, with lot of polish missing for version 1.0.0. ## Crate features | 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` | Adds`actix_web::Reponder` implementation to `zippity::Reader` | no | | `proptest` | Add module `zippity::proptest`, with strategies, and `proptest::arbitrary::Arbitrary` implementation for `Reader`. | no |