A powerful command-line compression tool written in Rust, inspired by 7-Zip but with a modern CLI interface—delivering up to ~100x faster compression and producing archives up to ~6,600x smaller than native zip on highly compressible data.
- Superior Compression: Achieves significantly higher compression ratios than native zip, especially on highly compressible data (up to 6,600x smaller archives).
- Fast Performance: Delivers up to 10x faster compression compared to native zip on suitable data types.
- Efficient Compression: Compress files and directories with customizable compression levels (1-9)
- Strong Security: Password protect your archives with secure encryption
- Volume Splitting: Split large archives into smaller volumes for easier sharing and storage
- Maximum Compression Mode: Optimize for smallest possible file sizes with the
--maxoption - Multi-Volume Support: Create and extract multi-part archives seamlessly
- Archive Management: List, extract, and verify archive contents
- User-Friendly CLI: Simple, intuitive command interface with clear progress indicators
1. Requirements
- Rust: 1.56.0 or newer
- 7z Command Line Tool: Ferrozip relies on the 7z command line tool for some operations
- On macOS:
brew install p7zip - On Ubuntu/Debian:
sudo apt-get install p7zip-full - On Windows: Install from 7-zip.org and ensure it's in your PATH
- On macOS:
2. Installation
# Clone the repository
git clone https://github.com/nim444/ferrozip.git
cd ferrozip
# Build with cargo
cargo build --release
# The executable will be in target/release/ferrozip
# Optional: Move to a directory in your PATH
cp target/release/ferrozip /usr/local/bin/ # Linux/macOS# Coming soon!
cargo install ferrozip# Coming soon!
brew install ferrozip# Coming soon!
snap install ferrozip3. Project Structure
├── .git/
├── .github/
│ └── workflows/
│ ├── build-linux.yml
│ ├── build-mac.yml
│ └── cargo-test.yml
├── src/
│ ├── main.rs # Application entry point
│ ├── cli/ # CLI functionality
│ │ ├── mod.rs # Module re-exports
│ │ ├── app.rs # CLI app definition
│ │ └── commands.rs # CLI commands
│ ├── compress/ # Compression functionality
│ │ ├── mod.rs # Module re-exports
│ │ ├── core.rs # Core compression logic
│ │ ├── split.rs # Archive splitting
│ │ ├── utils.rs # Compression utilities
│ │ └── tests.rs # Tests for compression
│ ├── decompress/ # Decompression functionality
│ │ ├── mod.rs # Module re-exports
│ │ ├── core.rs # Core decompression logic
│ │ ├── combine.rs # Archive combining
│ │ ├── list.rs # Archive listing
│ │ ├── utils.rs # Decompression utilities
│ │ └── tests.rs # Tests for decompression
│ └── helpers/ # Helper utilities
│ ├── mod.rs # Module re-exports
│ ├── size.rs # Size-related utilities
│ └── text.rs # Text-related utilities
├── .gitignore
├── Cargo.lock
├── Cargo.toml
└── README.md
4. Usage
Basic Commands
# Compress a directory
ferrozip compress my_folder
# Extract an archive
ferrozip extract archive.7z
# List archive contents
ferrozip list archive.7z5. Compression Options
# Set compression level (1-9, default is 6)
ferrozip compress data --level 8
# Maximum compression (equivalent to --level 9)
ferrozip compress large_folder --max
# Password protection
ferrozip compress sensitive_data --password "your_password"
# Split into volumes
ferrozip compress huge_folder --split 5g # 5GB volumes
ferrozip compress media --split 700m # CD-sized volumes
# Specify custom output filename
ferrozip compress documents --output backup.7z
# Combine multiple options
ferrozip compress important_data --max --split 2g --password "secure_password"6. Extraction Options
# Extract to specific directory
ferrozip extract archive.7z --output /path/to/extract
# Extract password-protected archive
ferrozip extract secure.7z --password "your_password"
# Extract split archive (just point to the first part)
ferrozip extract large_file.7z.0017. Size Units
When using the --split option, you can specify sizes with the following units:
gfor gigabytes (e.g.,5g= 5 gigabytes)mfor megabytes (e.g.,500m= 500 megabytes)kfor kilobytes (e.g.,1024k= 1 kilobyte)bfor bytes (e.g.,1048576b= 1,048,576 bytes)
8. Real-World Examples
# Back up your home folder with maximum compression
ferrozip compress $HOME/Documents --max --output documents_backup.7z
# Create encrypted backups of sensitive information
ferrozip compress financial_records --password "strong_password" --max
# Share large files by splitting them into manageable chunks
ferrozip compress large_dataset --split 1g --output dataset_to_share.7z
# Create DVD-sized backups
ferrozip compress media_collection --split 4.7g
# Quick compression of a project folder
ferrozip compress my_project --level 1 --output quick_backup.7z9. Troubleshooting
- "Failed to execute 7z command": Ensure the 7z command-line tool is installed and in your PATH
- "Archive does not exist": Check that the file path is correct and the archive exists
- "Invalid password": The password provided doesn't match the one used to encrypt the archive
- "Invalid size format": When using
--split, ensure you're using valid size units (g, m, k, b)
10. Performance Tips
- Use
--level 1for faster compression with larger file sizes - Use
--maxwhen storage space is the primary concern - For optimal balance, use the default compression level (6)
12. Compression Benchmark
This section presents a real-world compression benchmark comparing Ferrozip (using 7z/LZMA2) and native zip compression on highly compressible dummy database files.
-rw-r--r--@ 1 nk staff 15K May 7 13:22 dummy_100mb.7z
-rw-r--r--@ 1 nk staff 100M May 7 13:19 dummy_100mb.db
-rw-r--r--@ 1 nk staff 298K May 7 13:27 dummy_100mb.zip
-rw-r--r--@ 1 nk staff 155K May 7 13:29 dummy_1gb.7z
-rw-r--r--@ 1 nk staff 1.0G May 7 13:20 dummy_1gb.db
-rw-r--r--@ 1 nk staff 3.0M May 7 13:29 dummy_1gb.zip
| File | Original Size | .7z (Ferrozip) | .zip (Native) | Compression Ratio |
|---|---|---|---|---|
| dummy_100mb.db | 100 MB | 15 KB | 298 KB | ~6666x smaller (7z) |
| dummy_1gb.db | 1 GB | 155 KB | 3.0 MB | ~6,600x smaller (7z) |
11. Running Tests
Ferrozip uses Rust's built-in testing framework. Tests are typically located within the source files in the src/ directory (as modules named tests or functions annotated with #[test]).
To run the test suite, navigate to the project's root directory and execute:
cargo testThis command will compile the project in test mode and run all available tests, providing a summary of the results.
List of Tests
**`src/compress/tests.rs` and `src/compress/split.rs`**
test_split_into_multiple_volumestest_split_archive_smaller_than_volume_sizetest_split_archive_exact_multiple_of_volume_sizetest_split_empty_archivetest_split_volume_size_zero_returns_errortest_compress_large_file_and_show_sizes
src/decompress/tests.rs
test_combine_multiple_partstest_combine_single_parttest_combine_no_parts_foundtest_combine_missing_middle_parttest_combine_parts_in_subdirectory
src/helpers/size.rs and src/helpers/text.rs
test_parse_sizetest_format_sizetest_truncate_to_width
src/main.rs
test_directory_compression_extractiontest_single_file_compression_extractiontest_password_compression_extraction
You can download pre-compiled binaries for the most common platforms below. These are development builds from the latest commit. For other systems like Linux, please build from source using the included script.
| Platform | Architecture | Binary Link |
|---|---|---|
| Windows | x86_64 (64-bit) | ferrozip.exe |
| macOS | Intel (x86_64) | ferrozip |
| macOS | Apple Silicon (M1/M2) | ferrozip |
| Linux | Not provided | Build manually using build_multi_platform.sh |
Note: Ensure execution permission after download:
chmod +x ferrozip(macOS/Linux)
- Inspired by the 7-Zip project
- Built with Rust and various open-source libraries
- Coverage Information - Information about code coverage and testing