Crates.io | rustfs-zip |
lib.rs | rustfs-zip |
version | 0.0.3 |
created_at | 2025-07-04 07:30:54.092723+00 |
updated_at | 2025-07-04 07:30:54.092723+00 |
description | ZIP file handling for RustFS, providing support for reading and writing ZIP archives. |
homepage | https://rustfs.com |
repository | https://github.com/rustfs/rustfs |
max_upload_size | |
id | 1737551 |
size | 59,782 |
rustfs-zip
is a crate within the RustFS ecosystem designed for efficient, asynchronous handling of ZIP archives. It
provides robust support for both reading and writing ZIP files, leveraging the power of Tokio for non-blocking I/O
operations.
tokio
for high-performance, non-blocking ZIP file manipulation.zlib
, bzip2
, gzip
,
zstd
, and xz
.Add rustfs-zip
to your Cargo.toml
dependencies:
[dependencies]
rustfs-zip = "0.0.3" # Replace with the latest version
Here is a basic example of how to create a ZIP archive:
use tokio::fs::File;
use tokio::io::AsyncWriteExt;
use rustfs_zip::ZipWriter;
use rustfs_zip::write::FileOptions;
async fn create_archive() -> Result<(), Box<dyn std::error::Error>> {
let file = File::create("archive.zip").await?;
let mut zip = ZipWriter::new(file);
let options = FileOptions::default().compression_method(rustfs_zip::CompressionMethod::Deflated);
zip.start_file("file1.txt", options).await?;
zip.write_all(b"Hello, world!").await?;
zip.start_file("another/file.txt", options).await?;
zip.write_all(b"This is another file in a directory.").await?;
// Finish the archive.
zip.finish().await?;
Ok(())
}
This project is licensed under the Apache License, Version 2.0. See the LICENSE
file for details.