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