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