cosmopolitan/third_party/lz4cli/README

233 lines
11 KiB
Plaintext
Raw Normal View History

2020-06-15 14:18:57 +00:00
LZ4(1) Cosmopolitan User Commands -*-text-*-
๐๐€๐Œ๐„
๐—น๐˜‡๐Ÿฐ - lz4, unlz4, lz4cat - Compress or decompress .lz4 files
๐’๐˜๐๐Ž๐๐’๐ˆ๐’
๐—น๐˜‡๐Ÿฐ [OฬฒPฬฒTฬฒIฬฒOฬฒNฬฒSฬฒ] [-|INPUT-FILE] OฬฒUฬฒTฬฒPฬฒUฬฒTฬฒ-ฬฒFฬฒIฬฒLฬฒEฬฒ
๐˜‚๐—ป๐—น๐˜‡๐Ÿฐ is equivalent to ๐—น๐˜‡๐Ÿฐ -๐—ฑ
๐—น๐˜‡๐Ÿฐ๐—ฐ๐—ฎ๐˜ is equivalent to ๐—น๐˜‡๐Ÿฐ -๐—ฑ๐—ฐ๐—ณ๐—บ
When writing scripts that need to decompress files, it is recomโ€
mended to always use the name ๐—น๐˜‡๐Ÿฐ with appropriate arguments (๐—น๐˜‡๐Ÿฐ
-๐—ฑ or ๐—น๐˜‡๐Ÿฐ -๐—ฑ๐—ฐ) instead of the names ๐˜‚๐—ป๐—น๐˜‡๐Ÿฐ and ๐—น๐˜‡๐Ÿฐ๐—ฐ๐—ฎ๐˜.
๐ƒ๐„๐’๐‚๐‘๐ˆ๐๐“๐ˆ๐Ž๐
๐—น๐˜‡๐Ÿฐ is an extremely fast lossless compression algorithm, based on
๐—ฏ๐˜†๐˜๐—ฒ-๐—ฎ๐—น๐—ถ๐—ด๐—ป๐—ฒ๐—ฑ ๐‹๐™๐Ÿณ๐Ÿณ family of compression scheme. ๐—น๐˜‡๐Ÿฐ offers comโ€
pression speeds of 400 MB/s per core, linearly scalable with
multi-core CPUs. It features an extremely fast decoder, with
speed in multiple GB/s per core, typically reaching RAM speed
limit on multi-core systems. The native file format is the .๐—น๐˜‡๐Ÿฐ
format.
๐ƒ๐—ถ๐—ณ๐—ณ๐—ฒ๐—ฟ๐—ฒ๐—ป๐—ฐ๐—ฒ ๐—ฏ๐—ฒ๐˜๐˜„๐—ฒ๐—ฒ๐—ป ๐—น๐˜‡๐Ÿฐ ๐—ฎ๐—ป๐—ฑ ๐—ด๐˜‡๐—ถ๐—ฝ
๐—น๐˜‡๐Ÿฐ supports a command line syntax similar bฬฒuฬฒtฬฒ nฬฒoฬฒtฬฒ iฬฒdฬฒeฬฒnฬฒtฬฒiฬฒcฬฒaฬฒlฬฒ to
๐—ด๐˜‡๐—ถ๐—ฝ(๐Ÿญ). Differences are :
ยท ๐—น๐˜‡๐Ÿฐ preserves original files
ยท ๐—น๐˜‡๐Ÿฐ compresses a single file by default (see -๐—บ for multiple
files)
ยท ๐—น๐˜‡๐Ÿฐ ๐—ณ๐—ถ๐—น๐—ฒ๐Ÿญ ๐—ณ๐—ถ๐—น๐—ฒ๐Ÿฎ means : compress file1 iฬฒnฬฒtฬฒoฬฒ file2
ยท ๐—น๐˜‡๐Ÿฐ ๐—ณ๐—ถ๐—น๐—ฒ.๐—น๐˜‡๐Ÿฐ will default to decompression (use -๐˜‡ to force
compression)
ยท ๐—น๐˜‡๐Ÿฐ shows real-time notification statistics during compresโ€
sion or decompression of a single file (use -๐—พ to silence
them)
ยท If no destination name is provided, result is sent to ๐˜€๐˜๐—ฑ๐—ผ๐˜‚๐˜
eฬฒxฬฒcฬฒeฬฒpฬฒtฬฒ iฬฒfฬฒ sฬฒtฬฒdฬฒoฬฒuฬฒtฬฒ iฬฒsฬฒ tฬฒhฬฒeฬฒ cฬฒoฬฒnฬฒsฬฒoฬฒlฬฒeฬฒ.
ยท If no destination name is provided, ๐—ฎ๐—ป๐—ฑ if ๐˜€๐˜๐—ฑ๐—ผ๐˜‚๐˜ is the conโ€
sole, ๐—ณ๐—ถ๐—น๐—ฒ is compressed into ๐—ณ๐—ถ๐—น๐—ฒ.๐—น๐˜‡๐Ÿฐ.
ยท As a consequence of previous rules, note the following examโ€
ple : ๐—น๐˜‡๐Ÿฐ ๐—ณ๐—ถ๐—น๐—ฒ | ๐—ฐ๐—ผ๐—ป๐˜€๐˜‚๐—บ๐—ฒ๐—ฟ sends compressed data to ๐—ฐ๐—ผ๐—ป๐˜€๐˜‚๐—บ๐—ฒ๐—ฟ
through ๐˜€๐˜๐—ฑ๐—ผ๐˜‚๐˜, hence it does nฬฒoฬฒtฬฒ create ๐—ณ๐—ถ๐—น๐—ฒ.๐—น๐˜‡๐Ÿฐ.
ยท Another consequence of those rules is that to run ๐—น๐˜‡๐Ÿฐ under
๐—ป๐—ผ๐—ต๐˜‚๐—ฝ, you should provide a destination file: ๐—ป๐—ผ๐—ต๐˜‚๐—ฝ ๐—น๐˜‡๐Ÿฐ ๐—ณ๐—ถ๐—น๐—ฒ
๐—ณ๐—ถ๐—น๐—ฒ.๐—น๐˜‡๐Ÿฐ, because ๐—ป๐—ผ๐—ต๐˜‚๐—ฝ writes the specified commandยดs output
to a file.
Default behaviors can be modified by opt-in commands, detailed
below.
ยท ๐—น๐˜‡๐Ÿฐ -๐—บ makes it possible to provide multiple input filenames,
which will be compressed into files using suffix .๐—น๐˜‡๐Ÿฐ.
Progress notifications are also disabled by default (use -๐˜ƒ
to enable them). This mode has a behavior which more closely
mimics ๐—ด๐˜‡๐—ถ๐—ฝ command line, with the main remaining difference
being that source files are preserved by default.
ยท Similarly, ๐—น๐˜‡๐Ÿฐ -๐—บ -๐—ฑ can decompress multiple *.๐—น๐˜‡๐Ÿฐ files.
ยท Itยดs possible to opt-in to erase source files on successful
compression or decompression, using --๐—ฟ๐—บ command.
ยท Consequently, ๐—น๐˜‡๐Ÿฐ -๐—บ --๐—ฟ๐—บ behaves the same as ๐—ด๐˜‡๐—ถ๐—ฝ.
๐‚๐—ผ๐—ป๐—ฐ๐—ฎ๐˜๐—ฒ๐—ป๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—ผ๐—ณ .๐—น๐˜‡๐Ÿฐ ๐—ณ๐—ถ๐—น๐—ฒ๐˜€
It is possible to concatenate .๐—น๐˜‡๐Ÿฐ files as is. ๐—น๐˜‡๐Ÿฐ will decomโ€
press such files as if they were a single .๐—น๐˜‡๐Ÿฐ file. For example:
lz4 file1 > foo.lz4
lz4 file2 >> foo.lz4
Then ๐—น๐˜‡๐Ÿฐ๐—ฐ๐—ฎ๐˜ ๐—ณ๐—ผ๐—ผ.๐—น๐˜‡๐Ÿฐ is equivalent to ๐—ฐ๐—ฎ๐˜ ๐—ณ๐—ถ๐—น๐—ฒ๐Ÿญ ๐—ณ๐—ถ๐—น๐—ฒ๐Ÿฎ.
๐Ž๐๐“๐ˆ๐Ž๐๐’
๐’๐—ต๐—ผ๐—ฟ๐˜ ๐—ฐ๐—ผ๐—บ๐—บ๐—ฎ๐—ป๐—ฑ๐˜€ ๐—ฐ๐—ผ๐—ป๐—ฐ๐—ฎ๐˜๐—ฒ๐—ป๐—ฎ๐˜๐—ถ๐—ผ๐—ป
In some cases, some options can be expressed using short command
-๐˜… or long command --๐—น๐—ผ๐—ป๐—ด-๐˜„๐—ผ๐—ฟ๐—ฑ. Short commands can be concateโ€
nated together. For example, -๐—ฑ -๐—ฐ is equivalent to -๐—ฑ๐—ฐ. Long
commands cannot be concatenated. They must be clearly separated
by a space.
๐Œ๐˜‚๐—น๐˜๐—ถ๐—ฝ๐—น๐—ฒ ๐—ฐ๐—ผ๐—บ๐—บ๐—ฎ๐—ป๐—ฑ๐˜€
When multiple contradictory commands are issued on a same command
line, only the latest one will be applied.
๐Ž๐—ฝ๐—ฒ๐—ฟ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—บ๐—ผ๐—ฑ๐—ฒ
-๐˜‡ --๐—ฐ๐—ผ๐—บ๐—ฝ๐—ฟ๐—ฒ๐˜€๐˜€
Compress. This is the default operation mode when no operโ€
ation mode option is specified, no other operation mode is
implied from the command name (for example, ๐˜‚๐—ป๐—น๐˜‡๐Ÿฐ implies
--๐—ฑ๐—ฒ๐—ฐ๐—ผ๐—บ๐—ฝ๐—ฟ๐—ฒ๐˜€๐˜€), nor from the input file name (for example,
a file extension .๐—น๐˜‡๐Ÿฐ implies --๐—ฑ๐—ฒ๐—ฐ๐—ผ๐—บ๐—ฝ๐—ฟ๐—ฒ๐˜€๐˜€ by default). -๐˜‡
can also be used to force compression of an already comโ€
pressed .๐—น๐˜‡๐Ÿฐ file.
-๐—ฑ --๐—ฑ๐—ฒ๐—ฐ๐—ผ๐—บ๐—ฝ๐—ฟ๐—ฒ๐˜€๐˜€ --๐˜‚๐—ป๐—ฐ๐—ผ๐—บ๐—ฝ๐—ฟ๐—ฒ๐˜€๐˜€
Decompress. --๐—ฑ๐—ฒ๐—ฐ๐—ผ๐—บ๐—ฝ๐—ฟ๐—ฒ๐˜€๐˜€ is also the default operation
when the input filename has an .๐—น๐˜‡๐Ÿฐ extension.
-๐˜ --๐˜๐—ฒ๐˜€๐˜
Test the integrity of compressed .๐—น๐˜‡๐Ÿฐ files. The decomโ€
pressed data is discarded. No files are created nor
removed.
-๐—ฏ# Benchmark mode, using # compression level.
๐Ž๐—ฝ๐—ฒ๐—ฟ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—บ๐—ผ๐—ฑ๐—ถ๐—ณ๐—ถ๐—ฒ๐—ฟ๐˜€
-# Compression level, with # being any value from 1 to 12.
Higher values trade compression speed for compression
ratio. Values above 12 are considered the same as 12. Recโ€
ommended values are 1 for fast compression (default), and
9 for high compression. Speed/compression trade-off will
vary depending on data to compress. Decompression speed
remains fast at all settings.
-๐ƒ ๐—ฑ๐—ถ๐—ฐ๐˜๐—ถ๐—ผ๐—ป๐—ฎ๐—ฟ๐˜†๐๐—ฎ๐—บ๐—ฒ
Compress, decompress or benchmark using dictionary dฬฒiฬฒcฬฒtฬฒiฬฒoฬฒโ€ฬฒ
nฬฒaฬฒrฬฒyฬฒNฬฒaฬฒmฬฒeฬฒ. Compression and decompression must use the same
dictionary to be compatible. Using a different dictionary
during decompression will either abort due to decompresโ€
sion error, or generate a checksum error.
-๐—ณ --[๐—ป๐—ผ-]๐—ณ๐—ผ๐—ฟ๐—ฐ๐—ฒ
This option has several effects:
If the target file already exists, overwrite it without
prompting.
When used with --๐—ฑ๐—ฒ๐—ฐ๐—ผ๐—บ๐—ฝ๐—ฟ๐—ฒ๐˜€๐˜€ and ๐—น๐˜‡๐Ÿฐ cannot recognize the
type of the source file, copy the source file as is to
standard output. This allows ๐—น๐˜‡๐Ÿฐ๐—ฐ๐—ฎ๐˜ --๐—ณ๐—ผ๐—ฟ๐—ฐ๐—ฒ to be used
like ๐—ฐ๐—ฎ๐˜ (๐Ÿญ) for files that have not been compressed with
๐—น๐˜‡๐Ÿฐ.
-๐—ฐ --๐˜€๐˜๐—ฑ๐—ผ๐˜‚๐˜ --๐˜๐—ผ-๐˜€๐˜๐—ฑ๐—ผ๐˜‚๐˜
Force write to standard output, even if it is the console.
-๐—บ --๐—บ๐˜‚๐—น๐˜๐—ถ๐—ฝ๐—น๐—ฒ
Multiple input files. Compressed file names will be
appended a .๐—น๐˜‡๐Ÿฐ suffix. This mode also reduces notificaโ€
tion level. ๐—น๐˜‡๐Ÿฐ -๐—บ has a behavior equivalent to ๐—ด๐˜‡๐—ถ๐—ฝ -๐—ธ
(it preserves source files by default).
-๐—ฟ operate recursively on directories. This mode also sets -๐—บ
(multiple input files).
-๐# Block size [4-7](default : 7)
-๐๐Ÿฐ= 64KB ; -๐๐Ÿฑ= 256KB ; -๐๐Ÿฒ= 1MB ; -๐๐Ÿณ= 4MB
-๐๐ƒ Block Dependency (improves compression ratio on small
blocks)
--๐—ณ๐—ฎ๐˜€๐˜[=#]
switch to ultra-fast compression levels. If =# is not
present, it defaults to ๐Ÿญ. The higher the value, the
faster the compression speed, at the cost of some compresโ€
sion ratio. This setting overwrites compression level if
one was set previously. Similarly, if a compression level
is set after --๐—ณ๐—ฎ๐˜€๐˜, it overrides it.
--[๐—ป๐—ผ-]๐—ณ๐—ฟ๐—ฎ๐—บ๐—ฒ-๐—ฐ๐—ฟ๐—ฐ
Select frame checksum (default:enabled)
--[๐—ป๐—ผ-]๐—ฐ๐—ผ๐—ป๐˜๐—ฒ๐—ป๐˜-๐˜€๐—ถ๐˜‡๐—ฒ
Header includes original size (default:not present)
Note : this option can only be activated when the original
size can be determined, hence for a file. It wonยดt work
with unknown source size, such as stdin or pipe.
--[๐—ป๐—ผ-]๐˜€๐—ฝ๐—ฎ๐—ฟ๐˜€๐—ฒ
Sparse mode support (default:enabled on file, disabled on
stdout)
-๐—น Use Legacy format (typically for Linux Kernel compression)
Note : -๐—น is not compatible with -๐—บ (--๐—บ๐˜‚๐—น๐˜๐—ถ๐—ฝ๐—น๐—ฒ) nor -๐—ฟ
๐Ž๐˜๐—ต๐—ฒ๐—ฟ ๐—ผ๐—ฝ๐˜๐—ถ๐—ผ๐—ป๐˜€
-๐˜ƒ --๐˜ƒ๐—ฒ๐—ฟ๐—ฏ๐—ผ๐˜€๐—ฒ
Verbose mode
-๐—พ --๐—พ๐˜‚๐—ถ๐—ฒ๐˜
Suppress warnings and real-time statistics; specify twice
to suppress errors too
-๐—ต -๐‡ --๐—ต๐—ฒ๐—น๐—ฝ
Display help/long help and exit
-๐• --๐˜ƒ๐—ฒ๐—ฟ๐˜€๐—ถ๐—ผ๐—ป
Display Version number and exit
-๐—ธ --๐—ธ๐—ฒ๐—ฒ๐—ฝ
Preserve source files (default behavior)
--๐—ฟ๐—บ Delete source files on successful compression or decomโ€
pression
-- Treat all subsequent arguments as files
๐๐—ฒ๐—ป๐—ฐ๐—ต๐—บ๐—ฎ๐—ฟ๐—ธ ๐—บ๐—ผ๐—ฑ๐—ฒ
-๐—ฏ# Benchmark file(s), using # compression level
-๐—ฒ# Benchmark multiple compression levels, from b# to e#
(included)
-๐—ถ# Minimum evaluation time in seconds [1-9] (default : 3)
๐๐”๐†๐’
Report bugs at: https://github.com/lz4/lz4/issues
๐€๐”๐“๐‡๐Ž๐‘
Yann Collet
lz4 1.8.3 September 2018 LZ4(1)