Hi,
Please can you tell me if any of your installed libraries provide Brotli data compression?
I need to compress/decompress data in this format.
Thanks, Jamie
Hi,
Please can you tell me if any of your installed libraries provide Brotli data compression?
I need to compress/decompress data in this format.
Thanks, Jamie
It's not pre-installed, but it looks like it's pretty easy to install yourself. I got it working like this (in a bash console):
git clone https://github.com/google/brotli.git
cd brotli/
mkdir out && cd out
../configure-cmake --prefix=${HOME}/.local
make
make test
make install
pip3.6 install --user brotlipy
That installed the C library and the Python bindings. I was then able to decompress some of the library's test data:
Python 3.6.0 (default, Jan 13 2017, 00:00:00)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> with open("../tests/testdata/alice29.txt.compressed", "rb") as f:
... data = f.read()
...
>>> repr(data)[:20]
"b'[\\x18R\\x12E\\xa0;\\x"
>>> import brotli
>>> decompressed = brotli.decompress(data)
>>> decompressed[:100]
b"\r\n\r\n\r\n\r\n ALICE'S ADVENTURES IN WONDERLAND\r\n\r\n Lewis Carroll\r"
Thanks for taking the time to document that. That's great!
I had tried searching for information, but much of what I found was a few years old and I wondered if it was now included with another library.
With it being built into Firefox and Chrome these days I had assumed I must be missing something obvious.
No problem, glad to help!