https://github.com/alirexaa/mimee
A simple library for detection of a file's MIME type by its extension.
https://github.com/alirexaa/mimee
content-types filesystem mime mime-types rust web-programming
Last synced: about 14 hours ago
JSON representation
A simple library for detection of a file's MIME type by its extension.
- Host: GitHub
- URL: https://github.com/alirexaa/mimee
- Owner: Alirexaa
- License: mit
- Created: 2025-02-20T10:24:25.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-12-15T22:34:22.000Z (6 months ago)
- Last Synced: 2026-04-28T02:46:32.905Z (about 2 months ago)
- Topics: content-types, filesystem, mime, mime-types, rust, web-programming
- Language: Rust
- Homepage: https://docs.rs/crate/mimee/latest
- Size: 47.9 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mimee
Mimee is a Rust library that provides a mapping between file extensions and their corresponding MIME types. It allows you to easily determine the MIME type of a file based on its extension.
## Features
- Predefined set of file extensions and their corresponding MIME types.
- Retrieve the MIME type for a given file path.
- Supports both forward and backward slashes in file paths.
- Handles non-ASCII characters in file paths.
## Installation
Add this to your `Cargo.toml`:
```toml
[dependencies]
mimee = "0.2.0"
```
## Usage
```rust
use mimee::MimeDict;
fn main() {
let mut mime_dict = MimeDict::new();
let content_type = mime_dict.get_content_type("example.txt".to_string());
println!("MIME type: {:?}", content_type);
// Adding a custom MIME type
mime_dict.add(".custom".to_string(), "application/x-custom".to_string());
let custom_content_type = mime_dict.get_content_type("file.custom");
println!("Custom MIME type: {:?}", custom_content_type);
}
```
## License
This project is licensed under the MIT License