Suika MIME
Suika MIME is a library for handling MIME types in the Suika web stack.
Note: Suika is under active development and not intended for production use. The API is subject to change and may lack comprehensive testing and documentation.
Features
- Determine MIME type from file extension.
- Determine MIME type from file path.
- Comprehensive support for common file types.
- Extensible and easy to integrate into existing projects.
Installation
To use Suika MIME in your Rust project, add the following to your Cargo.toml:
[]
= "0.1.0"
Usage
Determining MIME Type from Extension
You can determine the MIME type based on a file extension using the
get_mime_type function.
use get_mime_type;
let mime_type = get_mime_type;
assert_eq!;
let mime_type = get_mime_type;
assert_eq!;
Determining MIME Type from File Path
You can determine the MIME type based on a file path using the
get_mime_type_from_path function.
use get_mime_type_from_path;
let mime_type = get_mime_type_from_path;
assert_eq!;
let mime_type = get_mime_type_from_path;
assert_eq!;
Supported MIME Types
Suika MIME supports a wide range of file types. Here are some of the supported extensions and their corresponding MIME types:
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