diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /third_party/rust/deflate/README.md | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/deflate/README.md')
-rw-r--r-- | third_party/rust/deflate/README.md | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/third_party/rust/deflate/README.md b/third_party/rust/deflate/README.md new file mode 100644 index 0000000000..fbfac39b68 --- /dev/null +++ b/third_party/rust/deflate/README.md @@ -0,0 +1,48 @@ +# deflate-rs + +[![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) + + +An 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. + +So 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). + +# Usage: +## Simple compression function: +``` rust +use deflate::deflate_bytes; + +let data = b"Some data"; +let compressed = deflate_bytes(&data); +``` + +## Using a writer: + +``` rust +use std::io::Write; + +use deflate::Compression; +use deflate::write::ZlibEncoder; + +let data = b"This is some test data"; +let mut encoder = ZlibEncoder::new(Vec::new(), Compression::Default); +encoder.write_all(data).unwrap(); +let compressed_data = encoder.finish().unwrap(); +``` + +# Other deflate/zlib rust projects from various people +* [flate2](http://alexcrichton.com/flate2-rs/flate2/index.html) FLATE, Gzip, and Zlib bindings for Rust +* [Zopfli in Rust](https://github.com/carols10cents/zopfli) Rust port of zopfli +* [inflate](https://github.com/PistonDevelopers/inflate) DEFLATE decoder implemented in rust +* [miniz-oxide](https://github.com/Frommi/miniz_oxide) Port of miniz to rust. +* [miniz-rs](https://github.com/alexchandel/miniz-rs) Older rust translation of miniz. +* [libflate](https://github.com/sile/libflate) Another DEFLATE/Zlib/Gzip encoder and decoder written in Rust. (Only does some very light compression). + +# License +deflate is distributed under the terms of both the MIT and Apache 2.0 licences. + +bitstream.rs is © @nwin and was released under both MIT and Apache 2.0 + +Some code in length_encode.rs has been ported from the `miniz` library, which is public domain. + +The 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 |