Function ben::encode::xz_compress
source · pub fn xz_compress<R: BufRead, W: Write>(reader: R, writer: W) -> Result<()>Expand description
This is a convenience function that applies level 9 LZMA2 compression to a general file.
§Arguments
reader- A buffered reader for the input filewriter- A writer for the output file
§Returns
A Result type that contains the result of the operation
use ben::encode::xz_compress;
use lipsum::lipsum;
use std::io::{BufReader, BufWriter};
let input = lipsum(100);
let reader = BufReader::new(input.as_bytes());
let mut output_buffer = Vec::new();
let writer = BufWriter::new(&mut output_buffer);
xz_compress(reader, writer).unwrap();
println!("{:?}", output_buffer);