s-zip
High-performance streaming ZIP library for Rust - Read/write ZIP files with minimal memory footprint.
Features
- 🚀 Streaming Read: Extract files from ZIP archives without loading entire archive into memory
- ✍️ Streaming Write: Create ZIP files with on-the-fly compression, no temp files needed
- 💾 Low Memory: Constant memory usage regardless of ZIP file size
- ⚡ Fast: Optimized for performance with minimal allocations
- 🎯 Simple API: Easy to use, intuitive interface
- 📦 No Dependencies: Only uses
flate2andcrc32fast
Quick Start
Add this to your Cargo.toml:
[]
= "0.1"
Reading a ZIP file
use StreamingZipReader;
Writing a ZIP file
use StreamingZipWriter;
Custom compression level
use StreamingZipWriter;
let mut writer = with_compression?; // Max compression
// ... add files ...
writer.finish?;
Why s-zip?
Most ZIP libraries in Rust either:
- Load entire files into memory (high memory usage)
- Require temp files for compression (slow, disk I/O)
- Have complex APIs with many features you don't need
s-zip focuses on:
- Streaming operations (read/write on-the-fly)
- Minimal memory footprint (constant memory usage)
- Simple, easy-to-use API
- Good performance for common use cases
Perfect for:
- Processing large ZIP archives
- Creating ZIP files from streaming data
- Memory-constrained environments
- High-performance data pipelines
Performance
- Memory: ~2-5 MB constant usage regardless of ZIP size
- Speed: Comparable to
zipcrate for common operations - No temp files: Direct streaming compression saves disk I/O
Limitations
- Only supports DEFLATE compression (most common)
- No ZIP64 support (max 4GB files) - coming soon
- No encryption support
- Write operations require
finish()call
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Related Projects
- excelstream - High-performance Excel library using s-zip
- zip - Full-featured ZIP library
Author
Ton That Vu - @KSD-CO