zipoxide
A Rust-powered, blazing fast ZIP utility. Leverages memory-mapped I/O and parallelism to read, create, and extract ZIP archives efficiently.
⚡ Features
- Read ZIP contents in parallel into memory buffers (
HashMap<String, Vec<u8>>), including password-protected archives. - Create ZIP archives from folders or lists of files, preserving directory structure, with configurable options.
- Extract ZIP archives in parallel using memory-mapped I/O, supporting optional passwords.
- Pure Rust, high-performance ZIP operations.
📦 Installation
Add zipoxide to your Cargo.toml:
[]
= "0.1"
Then build your project:
🧩 Usage
Read ZIP Contents into Memory
use read_zip_contents_into_buffer;
- Returns:
HashMap<String, Vec<u8>>where key = file name, value = file bytes. - Use case: Quickly access all files in a ZIP archive in memory, including encrypted files.
Create ZIP from a Folder
use create_zip_from_folder;
use FileOptions;
- Recursively compresses folder contents.
- Preserves directory structure inside the archive.
- Supports optional encryption via
FileOptions::encrypt_with(password).
Create ZIP from Files/Directories
use create_zip_from_files;
use FileOptions;
- Accepts a list of files or directories.
- Directories are recursively compressed.
- Paths inside the archive are relative to the input paths.
- Supports password-protected archives via
FileOptions.
Extract ZIP Archive
use extract_zip;
- Recreates the directory structure from the archive.
- Uses memory-mapped I/O and parallelism for faster extraction.
- Supports optional password for encrypted archives.
🏗 Architecture Notes
- Memory-mapped I/O: Efficient random access for reading and extracting files.
- Parallelism: Uses Rayon for parallelism.
- Thread safety:
Arc<Mutex<...>>ensures safe parallel writes to in-memory structures.
⚠️ Limitations
- Overhead of parallelism may outweigh benefits for archives with very few files.
- Panics if output ZIP file already exists.
📈 Performance
- Parallel reading and extraction scale with CPU cores.
- Memory-mapped I/O reduces disk read overhead.
- Optimized for large archives with many files.
🔧 Dependencies
📝 License
MIT License © [Rashikraj Shrestha]