Skip to content

FLATE, Gzip, and Zlib bindings for Rust

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

Frommi/flate2-rs

This branch is 10 commits ahead of, 472 commits behind rust-lang/flate2-rs:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1a893ec · Aug 29, 2017
May 26, 2017
Aug 29, 2017
Aug 12, 2017
Apr 24, 2017
Mar 29, 2017
Feb 5, 2015
Jul 24, 2017
Aug 29, 2017
Apr 14, 2017
Sep 3, 2014
Sep 3, 2014
Apr 14, 2017
Aug 10, 2017

Repository files navigation

flate2

Build Status Build status Crates.io Documentation

A streaming compression/decompression library for Rust. The underlying implementation by default uses miniz but can optionally be configured to use the system zlib, if available.

Supported formats:

  • deflate
  • zlib
  • gzip
# Cargo.toml
[dependencies]
flate2 = "0.2"

Using zlib instead of miniz:

[dependencies]
flate2 = { version = "0.2", features = ["zlib"], default-features = false }

Compression

extern crate flate2;

use std::io::prelude::*;
use flate2::Compression;
use flate2::write::ZlibEncoder;

fn main() {
    let mut e = ZlibEncoder::new(Vec::new(), Compression::Default);
    e.write(b"foo");
    e.write(b"bar");
    let compressed_bytes = e.finish();
}

Decompression

extern crate flate2;

use std::io::prelude::*;
use flate2::read::GzDecoder;

fn main() {
    let mut d = GzDecoder::new("...".as_bytes()).unwrap();
    let mut s = String::new();
    d.read_to_string(&mut s).unwrap();
    println!("{}", s);
}

License

flate2-rs is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.

See LICENSE-APACHE, and LICENSE-MIT for details.

About

FLATE, Gzip, and Zlib bindings for Rust

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%