Expand description
Fast, safe, self-contained MIME Type Identification.
§Examples
use mimty;
assert!(mimty::file("appendix/samples/cat.jpg") == Some("image/jpeg")); // by extension
assert!(mimty::file("appendix/samples/cat") == Some("image/jpeg")); // by magic number
assert!(mimty::blob(&[0xff, 0xd8, 0xff]) == Some("image/jpeg")); // by magic number
§Copyright
Copyright © 2015 Josh Morin JoshMorin@gmx.com
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Modules§
- ffi
- C function interface for this library
Functions§
- blob
- Attempt to identify a binary blob by its content
- file
- Attempt to identify a file by its extension and contents
Type Aliases§
- Mime
Type - Result of the file identification attempt