V1.8.3 Win64: Lz4

For many small files (e.g., a folder of JSON logs), you can train a dictionary and reuse it:

lz4 --train --train-fastcover=64,8 dictionary.dict *.json
lz4 -D dictionary.dict smallfile.json

v1.8.3 handles dictionaries more robustly than v1.8.2, especially on Windows. lz4 v1.8.3 win64


pip install lz4==3.1.0  # The version that bundles v1.8.3 under the hood

Then:

import lz4.frame
compressed = lz4.frame.compress(b"hello world"*1000)

LZ4 does not natively archive directories. Combine with tar: For many small files (e

tar cvf - myfolder | lz4 -9 > myfolder.tar.lz4

To extract:

lz4 -dc myfolder.tar.lz4 | tar xv

While v1.8.3 is robust, note the following for Win64 users: pip install lz4==3

lz4 -9 backup.iso

Uses level 9 (out of 1-12). Higher levels trade speed for slightly better ratios. v1.8.3 improved levels 10-12 specifically.