A lightweight Swift wrapper for Google's brotli
Brotli is a generic-purpose lossless compression algorithm that compresses data using a combination of a modern variant of the LZ77 algorithm, Huffman coding and 2nd order context modeling, with a compression ratio comparable to the best currently available general-purpose compression methods. It is similar in speed with deflate but offers more dense compression.
The specification of the Brotli Compressed Data Format is defined in RFC 7932.
Brotli uses a dictionary of common keywords and phrases on both client and server side and thus gives a better compression ratio for text data.
- https://medium.com/oyotech/how-brotli-compression-gave-us-37-latency-improvement-14d41e50fee4
- https://expeditedsecurity.com/blog/nginx-brotli/
- https://wp-rocket.me/blog/brotli-vs-gzip-compression/
let brotli = Brotli()
brotli.compress(data)
let brotli = Brotli()
brotli.decompress(data)
let encoder = BrotliJSONEncoder()
encoder.encode(object)
let decoder = BrotliJSONDecoder()
let result: Result<Object, Error> = decoder.decode(data)