brotli2 0.2.1

Bindings to libbrotli to provide brotli decompression and compression to Rust

Crate brotli2 [] [src]

Brotli Compression/Decompression for Rust

This crate is a binding to the official brotli implementation and provides in-memory and I/O streams for Rust wrappers.

Examples

use std::io::prelude::*;
use brotli2::read::{BrotliEncoder, BrotliDecoder};

// Round trip some bytes from a byte source, into a compressor, into a
// decompressor, and finally into a vector.
let data = "Hello, World!".as_bytes();
let compressor = BrotliEncoder::new(data, 9);
let mut decompressor = BrotliDecoder::new(compressor);

let mut contents = String::new();
decompressor.read_to_string(&mut contents).unwrap();
assert_eq!(contents, "Hello, World!");

Modules

bufread

I/O streams for wrapping BufRead types as encoders/decoders

read

Reader-based compression/decompression streams

stream

In-memory compression/decompression streams

write

Writer-based compression/decompression streams