filerepack
Lossless-first recompression for Office documents, archives, images, PDFs, video, and compressed data files. Nested files inside ZIP/7z/RAR/OOXML are walked and optimized, then the container is rewritten.
Python 3.9+ · macOS, Linux, Windows.
Install
pip install filerepack
pip install 'filerepack[parquet]' # DuckDB Parquet support
pip install 'filerepack[data]' # Parquet + ORC/Avro/Feather/Arrow
pip install 'filerepack[fonts]' # WOFF/WOFF2 via fonttools
pip install 'filerepack[progress]' # rich progress bars for repack and bulk --progress
External tools are optional per format. See what you have and how to install the rest on this OS:
filerepack doctor
Install commands use Homebrew or MacPorts on macOS, apt/dnf/pacman/zypper/apk on Linux, and Chocolatey/winget/Scoop on Windows. Full notes: docs/tools.md. Override paths with FILEREPACK_7ZZ (and similar) or ~/.config/filerepack/config.toml.
Quick start
filerepack repack document.docx
filerepack repack document.docx --dryrun
filerepack bulk ./documents --jobs auto --progress
filerepack bulk ./photos --include-ext jpg,png,webp
filerepack repack shows a progress bar on a TTY (--no-progress to hide it). bulk needs --progress. Install filerepack[progress] for a rich bar; otherwise progress prints every N files.
JPEG, PNG, and PDF default to lossless tools. Opt into lossy codecs with --lossy, --jpeg-quality, --png-quality, or --pdf-profile. Lossy PDF uses Ghostscript /ebook (150 dpi) so scanned pages actually shrink; --pdf-profile prepress restores print-quality Ghostscript. --jpeg-quality also re-encodes images inside PDFs. Output that is not smaller than the original is discarded unless --allow-grow.
filerepack repack scan.pdf --lossy
filerepack repack scan.pdf --pdf-profile printer --jpeg-quality 75
Full CLI: docs/cli.md. Library API: docs/library.md.
Formats
| Kind | Extensions |
|---|---|
| Office / OOXML | docx, xlsx, pptx, odt, ods, odp, ott, oth, otm, sxw, stw, pages, key, kth, vsdx, vssx, … |
| Archives | zip, 7z, rar, tar, tar.gz/tgz, tar.xz, tar.lzo, cab, wim, jar, epub, apk, aab, war, nupkg, oxt, … |
| Compressed | gz, xz, bz2, zst, br, lz4, lz, lzma, lzo, Z |
| Documents | pdf, ai (PDF-based) |
| Images | jpg, png, gif, webp, svg/svgz, tif, avif, heic, jxl, jp2, exr, dng, ico, psd, dcm |
| Video | mp4, mkv, webm, mov, m4v, wmv, avi, asf, 3gp, ts |
| Audio | flac, m4a (ALAC), wv, ape, tta, oga, mp3 |
| Data | parquet, orc, avro, feather/arrow, sqlite, gpkg, mbtiles, hdf5, netcdf |
| Fonts | woff, woff2 |
WMV/AVI/ASF/3GP/MPEG-TS convert to MP4 unless --no-convert-container. MKV/WebM/MOV/M4V keep their container. .tar.gz and friends are unpacked so nested files can be optimized, then the tarball is rewritten. Signed installers (deb, rpm, pkg, dmg) are not rewritten. DICOM (.dcm / .dicom / .dic) is lossless JPEG-LS only; --lossy does not apply. Needs gdcmconv or dcmcjpls.
Safety
Rewrites go to a temp file, are verified, then os.replaced onto the original. A missing 7zz/7z leaves the source archive untouched. filerepack doctor exits 1 if the required archiver is missing.
Library
from filerepack import FileRepacker, RepackOptions
rp = FileRepacker()
summary = rp.repack("slides.pptx", options=RepackOptions(dryrun=True))
print(summary.total_insize, summary.total_outsize, summary.total_savings_pct)
License
BSD. See CHANGELOG.md and CONTRIBUTING.md.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file filerepack-0.3.0.tar.gz.
File metadata
- Download URL: filerepack-0.3.0.tar.gz
- Upload date:
- Size: 62.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e59eb14944183c15bf5f43d98c7a0d765abb56a17e1f15c0e93459a58c27d75d
|
|
| MD5 |
c29f368dd0b63c56f7692d7bf8ae5150
|
|
| BLAKE2b-256 |
858a0c56c81c402976c39dd9b0bd4d5f4fae6bad615b5b8957034d94d180130e
|
File details
Details for the file filerepack-0.3.0-py3-none-any.whl.
File metadata
- Download URL: filerepack-0.3.0-py3-none-any.whl
- Upload date:
- Size: 48.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
570e55f61f101f88eb5046d42ffba39c47f02bec88f9ce31bdfd2e0442fcbbf6
|
|
| MD5 |
ef1e0ae77354c631e557400346e10aa1
|
|
| BLAKE2b-256 |
ba14e026f9c474783c732b91383b44640b24853cd8d26c645d3c45312ab44f58
|