| 1 | <p align="center"> |
| 2 | <img src="https://github.com/google/brotli/actions/workflows/build_test.yml/badge.svg" alt="GitHub Actions Build Status" href="https://github.com/google/brotli/actions?query=branch%3Amaster"> |
| 3 | <img src="https://oss-fuzz-build-logs.storage.googleapis.com/badges/brotli.svg" alt="Fuzzing Status" href="https://oss-fuzz-build-logs.storage.googleapis.com/index.html#brotli"> |
| 4 | </p> |
| 5 | <p align="center"><img src="https://brotli.org/brotli.svg" alt="Brotli" width="64"></p> |
| 6 | |
| 7 | ### Introduction |
| 8 | |
| 9 | Brotli is a generic-purpose lossless compression algorithm that compresses data |
| 10 | using a combination of a modern variant of the LZ77 algorithm, Huffman coding |
| 11 | and 2nd order context modeling, with a compression ratio comparable to the best |
| 12 | currently available general-purpose compression methods. It is similar in speed |
| 13 | with deflate but offers more dense compression. |
| 14 | |
| 15 | The specification of the Brotli Compressed Data Format is defined in |
| 16 | [RFC 7932](https://datatracker.ietf.org/doc/html/rfc7932). |
| 17 | |
| 18 | Brotli is open-sourced under the MIT License, see the LICENSE file. |
| 19 | |
| 20 | > **Please note:** brotli is a "stream" format; it does not contain |
| 21 | > meta-information, like checksums or uncompressed data length. It is possible |
| 22 | > to modify "raw" ranges of the compressed stream and the decoder will not |
| 23 | > notice that. |
| 24 | |
| 25 | ### Installation |
| 26 | |
| 27 | In most Linux distributions, installing `brotli` is just a matter of using |
| 28 | the package management system. For example in Debian-based distributions: |
| 29 | `apt install brotli` will install `brotli`. On MacOS, you can use |
| 30 | [Homebrew](https://brew.sh/): `brew install brotli`. |
| 31 | |
| 32 | [](https://repology.org/project/brotli/versions) |
| 33 | |
| 34 | Of course you can also build brotli from sources. |
| 35 | |
| 36 | ### Build instructions |
| 37 | |
| 38 | #### Vcpkg |
| 39 | |
| 40 | You can download and install brotli using the |
| 41 | [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager: |
| 42 | |
| 43 | git clone https://github.com/Microsoft/vcpkg.git |
| 44 | cd vcpkg |
| 45 | ./bootstrap-vcpkg.sh |
| 46 | ./vcpkg integrate install |
| 47 | ./vcpkg install brotli |
| 48 | |
| 49 | The brotli port in vcpkg is kept up to date by Microsoft team members and |
| 50 | community contributors. If the version is out of date, please [create an issue |
| 51 | or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. |
| 52 | |
| 53 | #### Bazel |
| 54 | |
| 55 | See [Bazel](https://www.bazel.build/) |
| 56 | |
| 57 | #### CMake |
| 58 | |
| 59 | The basic commands to build and install brotli are: |
| 60 | |
| 61 | $ mkdir out && cd out |
| 62 | $ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./installed .. |
| 63 | $ cmake --build . --config Release --target install |
| 64 | |
| 65 | You can use other [CMake](https://cmake.org/) configuration. |
| 66 | |
| 67 | #### Python |
| 68 | |
| 69 | To install the latest release of the Python module, run the following: |
| 70 | |
| 71 | $ pip install brotli |
| 72 | |
| 73 | To install the tip-of-the-tree version, run: |
| 74 | |
| 75 | $ pip install --upgrade git+https://github.com/google/brotli |
| 76 | |
| 77 | See the [Python readme](python/README.md) for more details on installing |
| 78 | from source, development, and testing. |
| 79 | |
| 80 | ### Contributing |
| 81 | |
| 82 | We glad to answer/library related questions in |
| 83 | [brotli mailing list](https://groups.google.com/g/brotli). |
| 84 | |
| 85 | Regular issues / feature requests should be reported in |
| 86 | [issue tracker](https://github.com/google/brotli/issues). |
| 87 | |
| 88 | For reporting vulnerability please read [SECURITY](SECURITY.md). |
| 89 | |
| 90 | For contributing changes please read [CONTRIBUTING](CONTRIBUTING.md). |
| 91 | |
| 92 | ### Benchmarks |
| 93 | * [Squash Compression Benchmark](https://quixdb.github.io/squash-benchmark/) / [Unstable Squash Compression Benchmark](https://quixdb.github.io/squash-benchmark/unstable/) |
| 94 | * [Large Text Compression Benchmark](https://mattmahoney.net/dc/text.html) |
| 95 | * [Lzturbo Benchmark](https://sites.google.com/site/powturbo/home/benchmark) |
| 96 | |
| 97 | ### Related projects |
| 98 | > **Disclaimer:** Brotli authors take no responsibility for the third party projects mentioned in this section. |
| 99 | |
| 100 | Independent [decoder](https://github.com/madler/brotli) implementation |
| 101 | by Mark Adler, based entirely on format specification. |
| 102 | |
| 103 | JavaScript port of brotli [decoder](https://github.com/devongovett/brotli.js). |
| 104 | Could be used directly via `npm install brotli` |
| 105 | |
| 106 | Hand ported [decoder / encoder](https://github.com/dominikhlbg/BrotliHaxe) |
| 107 | in haxe by Dominik Homberger. |
| 108 | Output source code: JavaScript, PHP, Python, Java and C# |
| 109 | |
| 110 | 7Zip [plugin](https://github.com/mcmilk/7-Zip-Zstd) |
| 111 | |
| 112 | Dart compression framework with |
| 113 | [fast FFI-based Brotli implementation](https://pub.dev/documentation/es_compression/latest/brotli/) |
| 114 | with ready-to-use prebuilt binaries for Win/Linux/Mac |