Skip to content

Commit

Permalink
update file_compressor example to work for non-text data
Browse files Browse the repository at this point in the history
  • Loading branch information
a10y committed Aug 15, 2024
1 parent e9b41bc commit b97469e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/file_compressor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ fn main() {
let train_path = Path::new(&args[0]);
let input_path = Path::new(&args[1]);

let mut train_text = String::new();
let mut train_bytes = Vec::new();
{
let mut f = File::open(train_path).unwrap();
f.read_to_string(&mut train_text).unwrap();
f.read_to_end(&mut train_bytes).unwrap();
}

println!("building the compressor from {train_path:?}...");
let compressor = fsst_rs::train(&train_text);
let compressor = fsst_rs::train(&train_bytes);

println!("compressing blocks of {input_path:?} with compressor...");

Expand Down

0 comments on commit b97469e

Please sign in to comment.