filetype

Crates.iofiletype
lib.rsfiletype
version0.2.0
sourcesrc
created_at2015-04-29 01:58:45.10519
updated_at2015-12-11 23:58:51.47213
descriptionThis crate provides a basic extension to `std::fs::File`: it defines a method which returns the file's type (on *nix systems).
homepage
repositoryhttps://github.com/dead10ck/filetype-rs
max_upload_size
id1980
size7,404
Skyler Hawthorne (dead10ck)

documentation

http://dead10ck.github.io/filetype-rs/filetype/

README

Build Status

API Documentation

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 => {},
}
Commit count: 27

cargo fmt