Skip to content

Instantly share code, notes, and snippets.

@sigriston
Created January 27, 2016 12:47
Show Gist options
  • Save sigriston/cd6043d6cf7940eef3cc to your computer and use it in GitHub Desktop.
Save sigriston/cd6043d6cf7940eef3cc to your computer and use it in GitHub Desktop.
rust gunzip
extern crate flate2;
use std::fs::File;
use std::io::Read;
use flate2::read::GzDecoder;
fn main() {
let gzhello = File::open("hello.txt.gz").unwrap();
let mut gunzipped = GzDecoder::new(gzhello).unwrap();
let mut hellostr = String::new();
gunzipped.read_to_string(&mut hellostr).unwrap();
print!("{}", hellostr);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment