mimee 0.2.0

A simple crate for detection of a file's MIME type by its extension.
Documentation
  • Coverage
  • 83.33%
    5 out of 6 items documented2 out of 4 items with examples
  • Size
  • Source code size: 84.24 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.73 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Alirexaa/mimee
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Alirexaa

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:

[dependencies]
mimee = "0.2.0"

Usage

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