fune/third_party/rust/flate2/examples/gzencoder-write.rs
Ray Kraesig a3a60fed58 Bug 1858739 - update flate2 crate to 1.0.26 r=glandium,supply-chain-reviewers
Includes an upgrade to the miniz_oxide crate (not otherwise used) from
0.6.2 to 0.7.1.

Differential Revision: https://phabricator.services.mozilla.com/D190837
2023-10-16 22:25:59 +00:00

10 lines
323 B
Rust

use flate2::write::GzEncoder;
use flate2::Compression;
use std::io::prelude::*;
// Vec<u8> implements Write to print the compressed bytes of sample string
fn main() {
let mut e = GzEncoder::new(Vec::new(), Compression::default());
e.write_all(b"Hello World").unwrap();
println!("{:?}", e.finish().unwrap());
}