rustfs-zip

Crates.iorustfs-zip
lib.rsrustfs-zip
version0.0.3
created_at2025-07-04 07:30:54.092723+00
updated_at2025-07-04 07:30:54.092723+00
descriptionZIP file handling for RustFS, providing support for reading and writing ZIP archives.
homepagehttps://rustfs.com
repositoryhttps://github.com/rustfs/rustfs
max_upload_size
id1737551
size59,782
houseme (houseme)

documentation

https://docs.rs/rustfs-zip/latest/rustfs_zip/

README

rustfs-zip

Crates.io Docs.rs License

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.

Features

  • Fully Asynchronous: Built on tokio for high-performance, non-blocking ZIP file manipulation.
  • Read & Write Support: Comprehensive APIs for creating new archives and extracting existing ones.
  • Multiple Compression Algorithms: Supports a wide range of compression methods, including zlib, bzip2, gzip, zstd, and xz.
  • Streaming API: Designed to handle large files efficiently without consuming excessive memory.

Installation

Add rustfs-zip to your Cargo.toml dependencies:

[dependencies]
rustfs-zip = "0.0.3" # Replace with the latest version

Usage

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(())
}

License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.

Commit count: 0

cargo fmt