A CLI tool for compressing and decompressing files in directories using Brotli compression.
Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # Linux/Mac
# or: venv\Scripts\activate # WindowsInstall dependencies:
pip install brotli pytestpip install brotli pytestRun the install script to install globally and use compress-all from anywhere:
./install.shAdd to PATH if needed:
export PATH="$HOME/.local/bin:$PATH"To update after pulling new changes:
./install.shThe script automatically detects previous installations and updates them.
To uninstall:
./uninstall.shpython src/main.py <path> [options]Where <path> is a file or directory containing files.
-c, --compressCompress files (default)-d, --decompressDecompress .br files-v, --verboseEnable verbose output-r, --remove-originalRemove original files after operation-e, --excludeList of directories to exclude (space-separated)-n, --dry-runShow what would be processed without executing-q, --qualityCompression quality 1-11 (default: 6)--versionShow version number-h, --helpShow help message
Compress all files in a directory:
python src/main.py ./myfiles -cDecompress .br files:
python src/main.py ./myfiles -dWith verbose output:
python src/main.py ./myfiles -vCompress and remove original files:
python src/main.py ./myfiles -c -rDecompress and remove .br files:
python src/main.py ./myfiles -d -rExclude directories from compression/decompression:
python src/main.py ./myfiles -c -e temp cacheExclude a subdirectory (relative path):
python src/main.py ./myfiles -c -e assets/imagesDry run (preview without executing):
python src/main.py ./myfiles -c -nCompress a single file:
python src/main.py ./myfiles/image.png -cDecompress a single file:
python src/main.py ./myfiles/image.png.br -dFast compression (lower ratio):
python src/main.py ./myfiles -c --quality 1Maximum compression (slower):
python src/main.py ./myfiles -c --quality 11- Files in the specified directory and its subdirectories are processed recursively
- Single files can also be compressed or decompressed directly
- Compressed files get a
.brextension added - Already compressed files (.br) are skipped during compression
- Only
.brfiles are processed during decompression - Original files are preserved after compression
- Directories specified in
--excludeare skipped entirely
Run all tests:
pytest tests/ -vRun a specific test file:
pytest tests/test_integration.py -vThis project was developed using artificial intelligence.
| Tool/LLM | Purpose |
|---|---|
| OpenCode | AI coding assistant |
| Claude (Anthropic) | Code generation and review |