1libflate
2========
3
4[![libflate](https://img.shields.io/crates/v/libflate.svg)](https://crates.io/crates/libflate)
5[![Documentation](https://docs.rs/libflate/badge.svg)](https://docs.rs/libflate)
6[![Actions Status](https://github.com/sile/libflate/workflows/CI/badge.svg)](https://github.com/sile/libflate/actions)
7[![Coverage Status](https://coveralls.io/repos/github/sile/libflate/badge.svg?branch=master)](https://coveralls.io/github/sile/libflate?branch=master)
8[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
10A Rust implementation of DEFLATE algorithm and related formats (ZLIB, GZIP).
11
12Documentation
13-------------
14
15See [RustDoc Documentation](https://docs.rs/libflate).
16
17The documentation includes some examples.
18
19Installation
20------------
21
22Add following lines to your `Cargo.toml`:
23
24```toml
25[dependencies]
26libflate = "1"
27```
28
29An Example
30----------
31
32Below is a command to decode GZIP stream that is read from the standard input:
33
34```rust
35extern crate libflate;
36
37use std::io;
38use libflate::gzip::Decoder;
39
40fn main() {
41    let mut input = io::stdin();
42    let mut decoder = Decoder::new(&mut input).unwrap();
43    io::copy(&mut decoder, &mut io::stdout()).unwrap();
44}
45```
46
47An Informal Benchmark
48---------------------
49
50A brief comparison with [flate2](https://github.com/alexcrichton/flate2-rs) and
51[inflate](https://github.com/PistonDevelopers/inflate):
52
53```bash
54$ cd libflate/flate_bench/
55$ curl -O https://dumps.wikimedia.org/enwiki/latest/enwiki-latest-all-titles-in-ns0.gz
56$ gzip -d enwiki-latest-all-titles-in-ns0.gz
57> ls -lh enwiki-latest-all-titles-in-ns0
58-rw-rw-r-- 1 foo foo 265M May 18 05:19 enwiki-latest-all-titles-in-ns0
59
60$ cargo run --release -- enwiki-latest-all-titles-in-ns0
61# ENCODE (input_size=277303937)
62- libflate: elapsed=8.137013s, size=83259010
63-   flate2: elapsed=9.814607s, size=74692153
64
65# DECODE (input_size=74217004)
66- libflate: elapsed=1.354556s, size=277303937
67-   flate2: elapsed=0.960907s, size=277303937
68-  inflate: elapsed=1.926142s, size=277303937
69```
70
71References
72----------
73
74- DEFLATE: [RFC-1951](https://tools.ietf.org/html/rfc1951)
75- ZLIB: [RFC-1950](https://tools.ietf.org/html/rfc1950)
76- GZIP: [RFC-1952](https://tools.ietf.org/html/rfc1952)
77