Created
January 27, 2016 12:47
-
-
Save sigriston/cd6043d6cf7940eef3cc to your computer and use it in GitHub Desktop.
rust gunzip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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