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

..03-May-2022-

benches/H03-May-2022-10883

src/H03-May-2022-6,6944,522

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

.cargo_vcs_info.jsonH A D06-Jul-202074 65

.gitignoreH A D29-Jul-2017275 1813

.travis.ymlH A D08-Sep-201999 1110

Cargo.tomlH A D06-Jul-20201.4 KiB4742

Cargo.toml.orig-cargoH A D06-Jul-2020840 3932

LICENSE-APACHEH A D29-Jul-201710.6 KiB202169

LICENSE-MITH A D29-Jul-20171 KiB2217

README.mdH A D29-Jan-20202.4 KiB5033

changelog.mdH A D06-Jul-2020799 3115

README.md

1# deflate-rs
2
3[![Build Status](https://travis-ci.org/image-rs/deflate-rs.svg)](https://travis-ci.org/image-rs/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, zlib miniz_oxide, and miniz.
7
8Deflate encoding with and without zlib and gzip metadata (zlib dictionaries are not supported) is supported. No unsafe code is used.
9
10This library is now mostly in maintenance mode, focus being on the Rust backend of [flate2](https://crates.io/crates/flate2) instead.
11
12# Usage:
13## Simple compression function:
14``` rust
15use deflate::deflate_bytes;
16
17let data = b"Some data";
18let compressed = deflate_bytes(&data);
19```
20
21## Using a writer:
22
23``` rust
24use std::io::Write;
25
26use deflate::Compression;
27use deflate::write::ZlibEncoder;
28
29let data = b"This is some test data";
30let mut encoder = ZlibEncoder::new(Vec::new(), Compression::Default);
31encoder.write_all(data).unwrap();
32let compressed_data = encoder.finish().unwrap();
33```
34
35# Other deflate/zlib Rust projects from various people
36* [flate2](http://alexcrichton.com/flate2-rs/flate2/index.html) FLATE, Gzip, and Zlib bindings for Rust - can use miniz_oxide for a pure Rust implementation.
37* [Zopfli in Rust](https://github.com/carols10cents/zopfli) Rust port of zopfli
38* [inflate](https://github.com/PistonDevelopers/inflate) DEFLATE decoder implemented in Rust
39* [miniz-oxide](https://github.com/Frommi/miniz_oxide) Port of miniz to Rust.
40* [libflate](https://github.com/sile/libflate) Another DEFLATE/Zlib/Gzip encoder and decoder written in Rust. (Only does some very light compression).
41
42# License
43deflate is distributed under the terms of both the MIT and Apache 2.0 licences.
44
45bitstream.rs is © @nwin and was released under both MIT and Apache 2.0
46
47Some code in length_encode.rs has been ported from the `miniz` library, which is public domain.
48
49The 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
50