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