fparkan/vendor/flate2/examples/zlibencoder-write.rs
Valentin Popov 1b6a04ca55
Initial vendor packages
Signed-off-by: Valentin Popov <valentin@popov.link>
2024-01-08 01:21:28 +04:00

11 lines
327 B
Rust

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