127b27ec6Sopenharmony_ciCommand Line Interface for LZ4 library 227b27ec6Sopenharmony_ci============================================ 327b27ec6Sopenharmony_ci 427b27ec6Sopenharmony_ci### Build 527b27ec6Sopenharmony_ciThe Command Line Interface (CLI) can be generated 627b27ec6Sopenharmony_ciusing the `make` command without any additional parameters. 727b27ec6Sopenharmony_ci 827b27ec6Sopenharmony_ciThe `Makefile` script supports all [standard conventions](https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html), 927b27ec6Sopenharmony_ciincluding standard targets (`all`, `install`, `clean`, etc.) 1027b27ec6Sopenharmony_ciand standard variables (`CC`, `CFLAGS`, `CPPFLAGS`, etc.). 1127b27ec6Sopenharmony_ci 1227b27ec6Sopenharmony_ciFor advanced use cases, there are targets to different variations of the CLI: 1327b27ec6Sopenharmony_ci- `lz4` : default CLI, with a command line syntax close to gzip 1427b27ec6Sopenharmony_ci- `lz4c` : Same as `lz4` with additional support legacy lz4 commands (incompatible with gzip) 1527b27ec6Sopenharmony_ci- `lz4c32` : Same as `lz4c`, but forced to compile in 32-bits mode 1627b27ec6Sopenharmony_ci 1727b27ec6Sopenharmony_ciThe CLI generates and decodes [LZ4-compressed frames](../doc/lz4_Frame_format.md). 1827b27ec6Sopenharmony_ci 1927b27ec6Sopenharmony_ci 2027b27ec6Sopenharmony_ci#### Aggregation of parameters 2127b27ec6Sopenharmony_ciCLI supports aggregation of parameters i.e. `-b1`, `-e18`, and `-i1` can be joined into `-b1e18i1`. 2227b27ec6Sopenharmony_ci 2327b27ec6Sopenharmony_ci 2427b27ec6Sopenharmony_ci#### Benchmark in Command Line Interface 2527b27ec6Sopenharmony_ciCLI includes in-memory compression benchmark module for lz4. 2627b27ec6Sopenharmony_ciThe benchmark is conducted using a given filename. 2727b27ec6Sopenharmony_ciThe file is read into memory. 2827b27ec6Sopenharmony_ciIt makes benchmark more precise as it eliminates I/O overhead. 2927b27ec6Sopenharmony_ci 3027b27ec6Sopenharmony_ciThe benchmark measures ratio, compressed size, compression and decompression speed. 3127b27ec6Sopenharmony_ciOne can select compression levels starting from `-b` and ending with `-e`. 3227b27ec6Sopenharmony_ciThe `-i` parameter selects a number of seconds used for each of tested levels. 3327b27ec6Sopenharmony_ci 3427b27ec6Sopenharmony_ci 3527b27ec6Sopenharmony_ci 3627b27ec6Sopenharmony_ci#### Usage of Command Line Interface 3727b27ec6Sopenharmony_ciThe full list of commands can be obtained with `-h` or `-H` parameter: 3827b27ec6Sopenharmony_ci``` 3927b27ec6Sopenharmony_ciUsage : 4027b27ec6Sopenharmony_ci lz4 [arg] [input] [output] 4127b27ec6Sopenharmony_ci 4227b27ec6Sopenharmony_ciinput : a filename 4327b27ec6Sopenharmony_ci with no FILE, or when FILE is - or stdin, read standard input 4427b27ec6Sopenharmony_ciArguments : 4527b27ec6Sopenharmony_ci -1 : Fast compression (default) 4627b27ec6Sopenharmony_ci -9 : High compression 4727b27ec6Sopenharmony_ci -d : decompression (default for .lz4 extension) 4827b27ec6Sopenharmony_ci -z : force compression 4927b27ec6Sopenharmony_ci -D FILE: use FILE as dictionary 5027b27ec6Sopenharmony_ci -f : overwrite output without prompting 5127b27ec6Sopenharmony_ci -k : preserve source files(s) (default) 5227b27ec6Sopenharmony_ci--rm : remove source file(s) after successful de/compression 5327b27ec6Sopenharmony_ci -h/-H : display help/long help and exit 5427b27ec6Sopenharmony_ci 5527b27ec6Sopenharmony_ciAdvanced arguments : 5627b27ec6Sopenharmony_ci -V : display Version number and exit 5727b27ec6Sopenharmony_ci -v : verbose mode 5827b27ec6Sopenharmony_ci -q : suppress warnings; specify twice to suppress errors too 5927b27ec6Sopenharmony_ci -c : force write to standard output, even if it is the console 6027b27ec6Sopenharmony_ci -t : test compressed file integrity 6127b27ec6Sopenharmony_ci -m : multiple input files (implies automatic output filenames) 6227b27ec6Sopenharmony_ci -r : operate recursively on directories (sets also -m) 6327b27ec6Sopenharmony_ci -l : compress using Legacy format (Linux kernel compression) 6427b27ec6Sopenharmony_ci -B# : cut file into blocks of size # bytes [32+] 6527b27ec6Sopenharmony_ci or predefined block size [4-7] (default: 7) 6627b27ec6Sopenharmony_ci -BD : Block dependency (improve compression ratio) 6727b27ec6Sopenharmony_ci -BX : enable block checksum (default:disabled) 6827b27ec6Sopenharmony_ci--no-frame-crc : disable stream checksum (default:enabled) 6927b27ec6Sopenharmony_ci--content-size : compressed frame includes original size (default:not present) 7027b27ec6Sopenharmony_ci--[no-]sparse : sparse mode (default:enabled on file, disabled on stdout) 7127b27ec6Sopenharmony_ci--favor-decSpeed: compressed files decompress faster, but are less compressed 7227b27ec6Sopenharmony_ci--fast[=#]: switch to ultra fast compression level (default: 1) 7327b27ec6Sopenharmony_ci 7427b27ec6Sopenharmony_ciBenchmark arguments : 7527b27ec6Sopenharmony_ci -b# : benchmark file(s), using # compression level (default : 1) 7627b27ec6Sopenharmony_ci -e# : test all compression levels from -bX to # (default : 1) 7727b27ec6Sopenharmony_ci -i# : minimum evaluation time in seconds (default : 3s)``` 7827b27ec6Sopenharmony_ci``` 7927b27ec6Sopenharmony_ci 8027b27ec6Sopenharmony_ci#### License 8127b27ec6Sopenharmony_ci 8227b27ec6Sopenharmony_ciAll files in this directory are licensed under GPL-v2. 8327b27ec6Sopenharmony_ciSee [COPYING](COPYING) for details. 8427b27ec6Sopenharmony_ciThe text of the license is also included at the top of each source file. 85