read_file/
read_file.rs

1use std::{env, fs};
2
3use binarygcode::binary_to_ascii;
4
5fn main() {
6    // Create the path to the gcode file
7    let mut path = env::current_dir().unwrap();
8    path.push("test_files");
9    path.push("mini_cube_b.bgcode");
10
11    let binary = fs::read(path).unwrap();
12    let gcode = binary_to_ascii(&binary, true).unwrap();
13    println!(
14        "Binary Length: {}, ASCII Lenght: {}",
15        binary.len(),
16        gcode.len()
17    );
18
19    fs::write("tmp/ascii.gcode", gcode.as_ref()).unwrap();
20}