Skip to content

dead10ck/filetype-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 => {},
}

About

Determines the file type of a file on *nix systems

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages