xref: /aosp_15_r20/external/brotli/c/tools/brotli.md (revision f4ee7fba7774faf2a30f13154332c0a06550dbc4)
1*f4ee7fbaSAndroid Build Coastguard Workerbrotli(1) -- brotli, unbrotli - compress or decompress files
2*f4ee7fbaSAndroid Build Coastguard Worker================================================================
3*f4ee7fbaSAndroid Build Coastguard Worker
4*f4ee7fbaSAndroid Build Coastguard WorkerSYNOPSIS
5*f4ee7fbaSAndroid Build Coastguard Worker--------
6*f4ee7fbaSAndroid Build Coastguard Worker
7*f4ee7fbaSAndroid Build Coastguard Worker`brotli` [*OPTION|FILE*]...
8*f4ee7fbaSAndroid Build Coastguard Worker
9*f4ee7fbaSAndroid Build Coastguard Worker`unbrotli` is equivalent to `brotli --decompress`
10*f4ee7fbaSAndroid Build Coastguard Worker
11*f4ee7fbaSAndroid Build Coastguard WorkerDESCRIPTION
12*f4ee7fbaSAndroid Build Coastguard Worker-----------
13*f4ee7fbaSAndroid Build Coastguard Worker`brotli` is a generic-purpose lossless compression algorithm that compresses
14*f4ee7fbaSAndroid Build Coastguard Workerdata using a combination of a modern variant of the **LZ77** algorithm, Huffman
15*f4ee7fbaSAndroid Build Coastguard Workercoding and 2-nd order context modeling, with a compression ratio comparable to
16*f4ee7fbaSAndroid Build Coastguard Workerthe best currently available general-purpose compression methods. It is similar
17*f4ee7fbaSAndroid Build Coastguard Workerin speed with deflate but offers more dense compression.
18*f4ee7fbaSAndroid Build Coastguard Worker
19*f4ee7fbaSAndroid Build Coastguard Worker`brotli` command line syntax similar to `gzip (1)` and `zstd (1)`.
20*f4ee7fbaSAndroid Build Coastguard WorkerUnlike `gzip (1)`, source files are preserved by default. It is possible to
21*f4ee7fbaSAndroid Build Coastguard Workerremove them after processing by using the `--rm` _option_.
22*f4ee7fbaSAndroid Build Coastguard Worker
23*f4ee7fbaSAndroid Build Coastguard WorkerArguments that look like "`--name`" or "`--name=value`" are _options_. Every
24*f4ee7fbaSAndroid Build Coastguard Worker_option_ has a short form "`-x`" or "`-x value`". Multiple short form _options_
25*f4ee7fbaSAndroid Build Coastguard Workercould be coalesced:
26*f4ee7fbaSAndroid Build Coastguard Worker
27*f4ee7fbaSAndroid Build Coastguard Worker* "`--decompress --stdout --suffix=.b`" works the same as
28*f4ee7fbaSAndroid Build Coastguard Worker* "`-d -s -S .b`" and
29*f4ee7fbaSAndroid Build Coastguard Worker* "`-dsS .b`"
30*f4ee7fbaSAndroid Build Coastguard Worker
31*f4ee7fbaSAndroid Build Coastguard Worker`brotli` has 3 operation modes:
32*f4ee7fbaSAndroid Build Coastguard Worker
33*f4ee7fbaSAndroid Build Coastguard Worker* default mode is compression;
34*f4ee7fbaSAndroid Build Coastguard Worker* `--decompress` option activates decompression mode;
35*f4ee7fbaSAndroid Build Coastguard Worker* `--test` option switches to integrity test mode; this option is equivalent to
36*f4ee7fbaSAndroid Build Coastguard Worker  "`--decompress --stdout`" except that the decompressed data is discarded
37*f4ee7fbaSAndroid Build Coastguard Worker  instead of being written to standard output.
38*f4ee7fbaSAndroid Build Coastguard Worker
39*f4ee7fbaSAndroid Build Coastguard WorkerEvery non-option argument is a _file_ entry. If no _files_ are given or _file_
40*f4ee7fbaSAndroid Build Coastguard Workeris "`-`", `brotli` reads from standard input. All arguments after "`--`" are
41*f4ee7fbaSAndroid Build Coastguard Worker_file_ entries.
42*f4ee7fbaSAndroid Build Coastguard Worker
43*f4ee7fbaSAndroid Build Coastguard WorkerUnless `--stdout` or `--output` is specified, _files_ are written to a new file
44*f4ee7fbaSAndroid Build Coastguard Workerwhose name is derived from the source _file_ name:
45*f4ee7fbaSAndroid Build Coastguard Worker
46*f4ee7fbaSAndroid Build Coastguard Worker* when compressing, a suffix is appended to the source filename to
47*f4ee7fbaSAndroid Build Coastguard Worker  get the target filename
48*f4ee7fbaSAndroid Build Coastguard Worker* when decompressing, a suffix is removed from the source filename to
49*f4ee7fbaSAndroid Build Coastguard Worker  get the target filename
50*f4ee7fbaSAndroid Build Coastguard Worker
51*f4ee7fbaSAndroid Build Coastguard WorkerDefault suffix is `.br`, but it could be specified with `--suffix` option.
52*f4ee7fbaSAndroid Build Coastguard Worker
53*f4ee7fbaSAndroid Build Coastguard WorkerConflicting or duplicate _options_ are not allowed.
54*f4ee7fbaSAndroid Build Coastguard Worker
55*f4ee7fbaSAndroid Build Coastguard WorkerOPTIONS
56*f4ee7fbaSAndroid Build Coastguard Worker-------
57*f4ee7fbaSAndroid Build Coastguard Worker
58*f4ee7fbaSAndroid Build Coastguard Worker* `-#`:
59*f4ee7fbaSAndroid Build Coastguard Worker    compression level (0-9); bigger values cause denser, but slower compression
60*f4ee7fbaSAndroid Build Coastguard Worker* `-c`, `--stdout`:
61*f4ee7fbaSAndroid Build Coastguard Worker    write on standard output
62*f4ee7fbaSAndroid Build Coastguard Worker* `-d`, `--decompress`:
63*f4ee7fbaSAndroid Build Coastguard Worker    decompress mode
64*f4ee7fbaSAndroid Build Coastguard Worker* `-f`, `--force`:
65*f4ee7fbaSAndroid Build Coastguard Worker    force output file overwrite
66*f4ee7fbaSAndroid Build Coastguard Worker* `-h`, `--help`:
67*f4ee7fbaSAndroid Build Coastguard Worker    display this help and exit
68*f4ee7fbaSAndroid Build Coastguard Worker* `-j`, `--rm`:
69*f4ee7fbaSAndroid Build Coastguard Worker    remove source file(s); `gzip (1)`-like behaviour
70*f4ee7fbaSAndroid Build Coastguard Worker* `-k`, `--keep`:
71*f4ee7fbaSAndroid Build Coastguard Worker    keep source file(s); `zstd (1)`-like behaviour
72*f4ee7fbaSAndroid Build Coastguard Worker* `-n`, `--no-copy-stat`:
73*f4ee7fbaSAndroid Build Coastguard Worker    do not copy source file(s) attributes
74*f4ee7fbaSAndroid Build Coastguard Worker* `-o FILE`, `--output=FILE`
75*f4ee7fbaSAndroid Build Coastguard Worker    output file; valid only if there is a single input entry
76*f4ee7fbaSAndroid Build Coastguard Worker* `-q NUM`, `--quality=NUM`:
77*f4ee7fbaSAndroid Build Coastguard Worker    compression level (0-11); bigger values cause denser, but slower compression
78*f4ee7fbaSAndroid Build Coastguard Worker* `-t`, `--test`:
79*f4ee7fbaSAndroid Build Coastguard Worker    test file integrity mode
80*f4ee7fbaSAndroid Build Coastguard Worker* `-v`, `--verbose`:
81*f4ee7fbaSAndroid Build Coastguard Worker    increase output verbosity
82*f4ee7fbaSAndroid Build Coastguard Worker* `-w NUM`, `--lgwin=NUM`:
83*f4ee7fbaSAndroid Build Coastguard Worker    set LZ77 window size (0, 10-24) (default: 22); window size is
84*f4ee7fbaSAndroid Build Coastguard Worker    `(2**NUM - 16)`; 0 lets compressor decide over the optimal value; bigger
85*f4ee7fbaSAndroid Build Coastguard Worker    windows size improve density; decoder might require up to window size
86*f4ee7fbaSAndroid Build Coastguard Worker    memory to operate
87*f4ee7fbaSAndroid Build Coastguard Worker* `-S SUF`, `--suffix=SUF`:
88*f4ee7fbaSAndroid Build Coastguard Worker    output file suffix (default: `.br`)
89*f4ee7fbaSAndroid Build Coastguard Worker* `-V`, `--version`:
90*f4ee7fbaSAndroid Build Coastguard Worker    display version and exit
91*f4ee7fbaSAndroid Build Coastguard Worker* `-Z`, `--best`:
92*f4ee7fbaSAndroid Build Coastguard Worker    use best compression level (default); same as "`-q 11`"
93*f4ee7fbaSAndroid Build Coastguard Worker
94*f4ee7fbaSAndroid Build Coastguard WorkerSEE ALSO
95*f4ee7fbaSAndroid Build Coastguard Worker--------
96*f4ee7fbaSAndroid Build Coastguard Worker
97*f4ee7fbaSAndroid Build Coastguard Worker`brotli` file format is defined in
98*f4ee7fbaSAndroid Build Coastguard Worker[RFC 7932](https://www.ietf.org/rfc/rfc7932.txt).
99*f4ee7fbaSAndroid Build Coastguard Worker
100*f4ee7fbaSAndroid Build Coastguard Worker`brotli` is open-sourced under the
101*f4ee7fbaSAndroid Build Coastguard Worker[MIT License](https://opensource.org/licenses/MIT).
102*f4ee7fbaSAndroid Build Coastguard Worker
103*f4ee7fbaSAndroid Build Coastguard WorkerMailing list: https://groups.google.com/forum/#!forum/brotli
104*f4ee7fbaSAndroid Build Coastguard Worker
105*f4ee7fbaSAndroid Build Coastguard WorkerBUGS
106*f4ee7fbaSAndroid Build Coastguard Worker----
107*f4ee7fbaSAndroid Build Coastguard WorkerReport bugs at: https://github.com/google/brotli/issues
108