• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

benches/H03-May-2022-11791

src/H03-May-2022-8,7926,534

tests/H03-May-2022-13696

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D01-Jan-197074 65

.gitignoreH A D29-Jul-2017275 1813

.travis.ymlH A D29-Jul-201787 109

Cargo.tomlH A D01-Jan-19701.3 KiB4540

Cargo.toml.orig-cargoH A D30-Jun-2019782 3327

LICENSE-APACHEH A D29-Jul-201710.6 KiB202169

LICENSE-MITH A D29-Jul-20171 KiB2217

README.mdH A D03-Apr-20182.5 KiB4933

README.md

1# deflate-rs
2
3[![Build Status](https://travis-ci.org/oyvindln/deflate-rs.svg)](https://travis-ci.org/oyvindln/deflate-rs)[![Crates.io](https://img.shields.io/crates/v/deflate.svg)](https://crates.io/crates/deflate)[![Docs](https://docs.rs/deflate/badge.svg)](https://docs.rs/deflate)
4
5
6An implementation of a [DEFLATE](http://www.gzip.org/zlib/rfc-deflate.html) encoder in pure rust. Not a direct port, but does take some inspiration from [zlib](http://www.zlib.net/), [miniz](https://github.com/richgel999/miniz) and [zopfli](https://github.com/google/zopfli). The API is based on the one in the [flate2](https://crates.io/crates/flate2) crate that contains bindings to zlib and miniz.
7
8So far, deflate encoding with and without zlib and gzip metadata (zlib dictionaryies are not supported yet) has been is implemented. Speed-wise it's not quite up to miniz-levels yet (between 10% and twice as slow for most files, seems to be slow on very small files, close to miniz on larger ones).
9
10# Usage:
11## Simple compression function:
12``` rust
13use deflate::deflate_bytes;
14
15let data = b"Some data";
16let compressed = deflate_bytes(&data);
17```
18
19## Using a writer:
20
21``` rust
22use std::io::Write;
23
24use deflate::Compression;
25use deflate::write::ZlibEncoder;
26
27let data = b"This is some test data";
28let mut encoder = ZlibEncoder::new(Vec::new(), Compression::Default);
29encoder.write_all(data).unwrap();
30let compressed_data = encoder.finish().unwrap();
31```
32
33# Other deflate/zlib rust projects from various people
34* [flate2](http://alexcrichton.com/flate2-rs/flate2/index.html) FLATE, Gzip, and Zlib bindings for Rust
35* [Zopfli in Rust](https://github.com/carols10cents/zopfli) Rust port of zopfli
36* [inflate](https://github.com/PistonDevelopers/inflate) DEFLATE decoder implemented in rust
37* [miniz-oxide](https://github.com/Frommi/miniz_oxide) Port of miniz to rust.
38* [miniz-rs](https://github.com/alexchandel/miniz-rs) Older rust translation of miniz.
39* [libflate](https://github.com/sile/libflate) Another DEFLATE/Zlib/Gzip encoder and decoder written in Rust. (Only does some very light compression).
40
41# License
42deflate is distributed under the terms of both the MIT and Apache 2.0 licences.
43
44bitstream.rs is © @nwin and was released under both MIT and Apache 2.0
45
46Some code in length_encode.rs has been ported from the `miniz` library, which is public domain.
47
48The test data (src/pg11.txt) is borrowed from [Project Gutenberg](https://www.gutenberg.org/ebooks/11) and is available under public domain, or the Project Gutenberg Licence
49