| Crates.io | suika_mime |
| lib.rs | suika_mime |
| version | 0.1.2 |
| created_at | 2025-01-01 21:34:14.510914+00 |
| updated_at | 2025-06-15 22:31:57.113719+00 |
| description | A library for handling MIME types in the suika web stack |
| homepage | |
| repository | https://github.com/JonWatkins/suika/tree/master/crates/suika_mime |
| max_upload_size | |
| id | 1501095 |
| size | 20,330 |
Important: This is a personal toy project, developed as an experiment and learning exercise.
As a toy project, its future development is uncertain. It may or may not receive future updates, maintenance, or bug fixes. Please do not use it in production environments.
Suika MIME is a utility library for handling MIME types within the Suika web stack (also a toy project). It provides basic functionality for determining MIME types from file extensions or paths, primarily for understanding web asset serving and for experimental purposes.
The API is subject to change. This project is not thoroughly tested or hardened for real-world applications, and documentation may be basic.
You can determine the MIME type based on a file extension using the get_mime_type function.
use suika_mime::get_mime_type;
let mime_type = get_mime_type("html");
assert_eq!(mime_type, "text/html".to_string());
let mime_type = get_mime_type("png");
assert_eq!(mime_type, "image/png".to_string());
You can determine the MIME type based on a file path using the get_mime_type_from_path function.
use suika_mime::get_mime_type_from_path;
let mime_type = get_mime_type_from_path("index.html");
assert_eq!(mime_type, "text/html".to_string());
let mime_type = get_mime_type_from_path("images/photo.png");
assert_eq!(mime_type, "image/png".to_string());
Suika MIME supports a range of common file types. This list is for reference and may not be exhaustive or perfectly up-to-date with external standards.
html, htm: text/htmlcss: text/cssjs, mjs: application/javascriptjson: application/jsonxml: application/xmlpdf: application/pdfzip: application/ziptar: application/x-targz: application/gzipbz2: application/x-bzip27z: application/x-7z-compressedrar: application/vnd.rarexe: application/vnd.microsoft.portable-executablemsi: application/x-msdownloadbin, dll, iso, dmg: application/octet-streampng: image/pngjpg, jpeg: image/jpeggif: image/gifsvg: image/svg+xmlbmp: image/bmpico: image/x-icontiff, tif: image/tiffwebp: image/webpmp3: audio/mpegwav: audio/wavogg: audio/oggflac: audio/flacaac: audio/aacmp4: video/mp4m4v: video/x-m4vmkv: video/x-matroskawebm: video/webmavi: video/x-msvideomov: video/quicktimewmv: video/x-ms-wmvtxt: text/plaincsv: text/csvmd: text/markdownrtf: application/rtfodt: application/vnd.oasis.opendocument.textods: application/vnd.oasis.opendocument.spreadsheetodp: application/vnd.oasis.opendocument.presentationdoc: application/msworddocx:
application/vnd.openxmlformats-officedocument.wordprocessingml.documentxls: application/vnd.ms-excelxlsx: application/vnd.openxmlformats-officedocument.spreadsheetml.sheetppt: application/vnd.ms-powerpointpptx:
application/vnd.openxmlformats-officedocument.presentationml.presentation