wasmer/lib/wasi-tests/wasitests/file_metadata.rs

21 lines
476 B
Rust
Raw Normal View History

// Args:
// dir: .
2019-05-17 22:31:02 +00:00
use std::fs;
use std::io::Read;
fn main() {
let mut this_file =
fs::File::open("wasitests/file_metadata.rs").expect("could not find src file");
let md = this_file.metadata().unwrap();
println!("is dir: {}", md.is_dir());
2019-05-20 16:24:55 +00:00
let filetype = md.file_type();
2019-05-17 22:31:02 +00:00
println!(
2019-05-20 16:24:55 +00:00
"filetype: {} {} {}",
filetype.is_dir(),
filetype.is_file(),
filetype.is_symlink()
2019-05-17 22:31:02 +00:00
);
2019-05-20 22:02:22 +00:00
println!("file info: {}", md.len());
2019-05-17 22:31:02 +00:00
}