About tukaani-project/xz
XZ Utils provide a general-purpose data-compression library plus command-line tools. The native file format is the .xz format, but also the legacy .lzma format is supported. The .xz format supports multiple compression algorithms called filters, with LZMA2 being the primary filter. With typical files, XZ Utils create about 30% smaller files than gzip. The API of liblzma is similar to zlib, and the command-line tool xz has syntax similar to gzip. XZ Utils supports multithreaded compression and can chain up to four filters for improved compression on certain file types like executables using BCJ filters.
Key Features
Supports .xz and .lzma formats
LZMA2 primary compression filter
Approximately 30% better compression ratio than gzip
Command-line syntax similar to gzip
liblzma API similar to zlib
Multithreaded compression support
Filter chaining (up to four filters) including BCJ for executables
Fast decompression suitable for software distribution
Pros & Cons
Pros
- Superior compression ratio compared to gzip and bzip2
- Fast decompression, ideal for distributing files decompressed many times
- Open source and widely available
- Well-documented with comprehensive API and command-line help
- Multithreaded compression leverages multi-core CPUs
Cons
- Compression can be CPU-intensive and memory-heavy for highest ratios
- Multithreaded decompression not yet supported
- Decompression slightly slower than gzip (but much faster than bzip2)
Best For
Software package distributionCompressing executable files with BCJ filterGeneral file compression and archivingReplacing gzip or bzip2 for better compression ratio or speed trade-offs
FAQ
What file formats does XZ Utils support?
XZ Utils supports the native .xz format and the legacy .lzma format.
How does the compression ratio compare to gzip?
With typical files, XZ Utils create about 30% smaller files than gzip.
Is multithreading supported?
XZ Utils supports multithreaded compression but not yet multithreaded decompression.