Crates.io | filetype |
lib.rs | filetype |
version | 0.2.0 |
source | src |
created_at | 2015-04-29 01:58:45.10519 |
updated_at | 2015-12-11 23:58:51.47213 |
description | This crate provides a basic extension to `std::fs::File`: it defines a method which returns the file's type (on *nix systems). |
homepage | |
repository | https://github.com/dead10ck/filetype-rs |
max_upload_size | |
id | 1980 |
size | 7,404 |
This is a pet project, and not tested very well (contributions welcome!). Use at your own risk.
This crate provides a basic extension to std::fs::File
: it defines a method
which returns the file's type (on *nix systems).
extern crate filetype;
use std::fs;
use std::fs::File;
use filetype::{FileType, UnixFileType};
let f = File::open("foo").unwrap();
let ftype = f.file_type().unwrap();
match ftype {
FileType::Regular => {},
FileType::Directory => {},
FileType::Symlink => {},
FileType::NamedPipe => {},
FileType::BlockDevice => {},
FileType::CharacterDevice => {},
}