example1/
example1.rs

1extern crate filetools;
2use std::{env};
3fn main() {
4    //当前目录
5    let current_dir =env::current_dir().unwrap();
6    let current_dir_path  =current_dir.to_str().unwrap();
7    //文本文件判断
8    let test_file1_path =format!("{}/examples/test_file1.txt",&current_dir_path);
9    println!("test_file1:{}",filetools::is_binary_file(&test_file1_path).unwrap());
10
11
12    //二进制文件判断
13    let test_file2_path =format!("{}/examples/test_file2.jpg",&current_dir_path);
14    println!("test_file2:{}",filetools::is_binary_file(&test_file2_path).unwrap());
15}