web: add extension to media type map
This commit is contained in:
171
packages/web/src/mime.zig
Normal file
171
packages/web/src/mime.zig
Normal file
@@ -0,0 +1,171 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub const extension_to_media_type: std.StaticStringMap([]const u8) = .initComptime(.{
|
||||
.{ "7z", "application/x-7z-compressed" },
|
||||
.{ "aac", "audio/aac" },
|
||||
.{ "abw", "application/x-abiword" },
|
||||
.{ "apng", "image/apng" },
|
||||
.{ "arc", "application/x-freearc" },
|
||||
.{ "avi", "video/x-msvideo" },
|
||||
.{ "avif", "image/avif" },
|
||||
.{ "azw", "application/vnd.amazon.ebook" },
|
||||
.{ "bin", "application/octet-stream" },
|
||||
.{ "blend", "application/x-blender" },
|
||||
.{ "bmp", "image/bmp" },
|
||||
.{ "bsp", "model/vnd.valve.source.compiled-map" },
|
||||
.{ "bz", "application/x-bzip" },
|
||||
.{ "bz2", "application/x-bzip2" },
|
||||
.{ "cbor", "application/cbor" },
|
||||
.{ "cda", "application/x-cdf" },
|
||||
.{ "cer", "application/pkix-cert" },
|
||||
.{ "chm", "application/vnd.ms-htmlhelp" },
|
||||
.{ "csh", "application/x-csh" },
|
||||
.{ "css", "text/css" },
|
||||
.{ "csv", "text/csv" },
|
||||
.{ "dae", "model/vnd.collada+xml" },
|
||||
.{ "docm", "application/vnd.ms-word.document.macroEnabled.12" },
|
||||
.{ "docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document" },
|
||||
.{ "dotm", "application/vnd.ms-word.template.macroEnabled.12" },
|
||||
.{ "dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template" },
|
||||
.{ "dwf", "model/vnd.dwf" },
|
||||
.{ "dwg", "image/vnd.dwg" },
|
||||
.{ "dxf", "image/vnd.dxf" },
|
||||
.{ "efi", "application/efi" },
|
||||
.{ "eot", "application/vnd.ms-fontobject" },
|
||||
.{ "epub", "application/epub+zip" },
|
||||
.{ "exr", "image/x-exr" },
|
||||
.{ "flax", "audio/flac" },
|
||||
.{ "flv", "video/x-flv" },
|
||||
.{ "gif", "image/gif" },
|
||||
.{ "glb", "model/gltf-binary" },
|
||||
.{ "glbin", "application/gltf-buffer" },
|
||||
.{ "glbuf", "application/gltf-buffer" },
|
||||
.{ "gltf", "model/gltf+json" },
|
||||
.{ "gz", "application/gzip" },
|
||||
.{ "hdr", "image/vnd.radiance" },
|
||||
.{ "heic", "image/heic" },
|
||||
.{ "heif", "image/heif" },
|
||||
.{ "htm", "text/html" },
|
||||
.{ "html", "text/html" },
|
||||
.{ "ico", "image/vnd.microsoft.icon" },
|
||||
.{ "ics", "text/calendar" },
|
||||
.{ "iges", "model/iges" },
|
||||
.{ "igs", "model/iges" },
|
||||
.{ "jar", "application/java-archive" },
|
||||
.{ "jpeg", "image/jpeg" },
|
||||
.{ "jpg", "image/jpeg" },
|
||||
.{ "js", "text/javascript" },
|
||||
.{ "json", "application/json" },
|
||||
.{ "jsonld", "application/ld+json" },
|
||||
.{ "jxl", "image/jxl" },
|
||||
.{ "ktx", "image/ktx" },
|
||||
.{ "ktx2", "image/ktx2" },
|
||||
.{ "m3u", "application/vnd.apple.mpegurl" },
|
||||
.{ "m3u8", "application/vnd.apple.mpegurl" },
|
||||
.{ "m4u", "video/vnd.mpegurl" },
|
||||
.{ "md", "text/markdown" },
|
||||
.{ "mdb", "application/vnd.ms-access" },
|
||||
.{ "mdi", "image/vnd.ms-modi" },
|
||||
.{ "mid", "audio/midi" },
|
||||
.{ "midi", "audio/midi" },
|
||||
.{ "mjs", "text/javascript" },
|
||||
.{ "mka", "audio/matroska" },
|
||||
.{ "mkv", "video/matroska" },
|
||||
.{ "mml", "application/mathml+xml" },
|
||||
.{ "mov", "video/quicktime" },
|
||||
.{ "mp3", "audio/mpeg" },
|
||||
.{ "mp4", "video/mp4" },
|
||||
.{ "mpeg", "video/mpeg" },
|
||||
.{ "mpkg", "application/vnd.apple.installer+xml" },
|
||||
.{ "mtl", "model/mtl" },
|
||||
.{ "mxl", "application/vnd.recordare.musicxml" },
|
||||
.{ "mxu", "video/vnd.mpegurl" },
|
||||
.{ "obj", "model/obj" }, // .obj could be MSVC object file too, but Wavefront OBJ is more likely
|
||||
.{ "odp", "application/vnd.oasis.opendocument.presentation" },
|
||||
.{ "ods", "application/vnd.oasis.opendocument.spreadsheet" },
|
||||
.{ "odt", "application/vnd.oasis.opendocument.text" },
|
||||
.{ "oga", "audio/ogg" },
|
||||
.{ "ogex", "model/vnd.opengex" },
|
||||
.{ "ogv", "video/ogg" },
|
||||
.{ "ogx", "application/ogg" },
|
||||
.{ "opus", "audio/ogg" },
|
||||
.{ "otf", "font/otf" },
|
||||
.{ "p10", "application/pkcs10" },
|
||||
.{ "p12", "application/pkcs12" },
|
||||
.{ "p8", "application/pkcs8" },
|
||||
.{ "pdf", "application/pdf" },
|
||||
.{ "pfx", "application/pkcs12" },
|
||||
.{ "php", "application/x-httpd-php" },
|
||||
.{ "pki", "application/pkixcmp" },
|
||||
.{ "png", "image/png" },
|
||||
.{ "pot", "application/vnd.ms-powerpoint" },
|
||||
.{ "potm", "application/vnd.ms-powerpoint.template.macroEnabled.12" },
|
||||
.{ "potx", "application/vnd.openxmlformats-officedocument.presentationml.template" },
|
||||
.{ "ppa", "application/vnd.ms-powerpoint" },
|
||||
.{ "ppam", "application/vnd.ms-powerpoint.addin.macroEnabled.12" },
|
||||
.{ "pps", "application/vnd.ms-powerpoint" },
|
||||
.{ "ppsm", "application/vnd.ms-powerpoint.slideshow.macroEnabled.12" },
|
||||
.{ "ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow" },
|
||||
.{ "ppt", "application/vnd.ms-powerpoint" },
|
||||
.{ "pptm", "application/vnd.ms-powerpoint.presentation.macroEnabled.12" },
|
||||
.{ "pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation" },
|
||||
.{ "ps", "application/postscript" },
|
||||
.{ "psd", "image/vnd.adobe.photoshop" },
|
||||
.{ "qoa", "audio/qoa" },
|
||||
.{ "qoi", "image/qoi" },
|
||||
.{ "qt", "video/quicktime" },
|
||||
.{ "rar", "application/vnd.rar" },
|
||||
.{ "rmvb", "application/vnd.rn-realmedia-vbr" },
|
||||
.{ "rtf", "application/rtf" },
|
||||
.{ "sf2", "audio/soundfont" },
|
||||
.{ "sh", "application/x-sh" },
|
||||
.{ "sql", "application/sql" },
|
||||
.{ "step", "model/step" },
|
||||
.{ "stl", "model/stl" },
|
||||
.{ "stp", "model/step" },
|
||||
.{ "stpx", "model/step+xml" },
|
||||
.{ "stpxz", "model/step-xml+zip" },
|
||||
.{ "stpz", "model/step+zip" },
|
||||
.{ "svg", "image/svg+xml" },
|
||||
.{ "tar", "application/x-tar" },
|
||||
.{ "tif", "image/tiff" },
|
||||
.{ "tiff", "image/tiff" },
|
||||
.{ "toml", "application/toml" },
|
||||
.{ "ttf", "font/ttf" },
|
||||
.{ "txt", "text/plain" },
|
||||
.{ "usda", "model/vnd.usda" },
|
||||
.{ "usdz", "model/vnd.usdz+zip" },
|
||||
.{ "vcard", "text/vcard" },
|
||||
.{ "vcf", "text/vcard" },
|
||||
.{ "vsd", "application/vnd.visio" },
|
||||
.{ "vtf", "image/vnd.valve.source.texture" },
|
||||
.{ "wav", "audio/wav" },
|
||||
.{ "weba", "audio/webm" },
|
||||
.{ "webm", "video/webm" },
|
||||
.{ "webmanifest", "application/manifest+json" },
|
||||
.{ "webp", "image/webp" },
|
||||
.{ "wgsl", "text/wgsl" },
|
||||
.{ "wma", "audio/x-ms-asf" },
|
||||
.{ "wmv", "video/x-ms-asf" },
|
||||
.{ "woff", "font/woff" },
|
||||
.{ "woff2", "font/woff2" },
|
||||
.{ "xht", "application/xhtml+xml" },
|
||||
.{ "xhtml", "application/xhtml+xml" },
|
||||
.{ "xla", "application/vnd.ms-excel" },
|
||||
.{ "xlam", "application/vnd.ms-excel.addin.macroEnabled.12" },
|
||||
.{ "xls", "application/vnd.ms-excel" },
|
||||
.{ "xlsb", "application/vnd.ms-excel.sheet.binary.macroEnabled.12" },
|
||||
.{ "xlsm", "application/vnd.ms-excel.sheet.macroEnabled.12" },
|
||||
.{ "xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" },
|
||||
.{ "xlt", "application/vnd.ms-excel" },
|
||||
.{ "xltm", "application/vnd.ms-excel.template.macroEnabled.12" },
|
||||
.{ "xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template" },
|
||||
.{ "xml", "application/xml" },
|
||||
.{ "xsl", "application/xslt+xml" },
|
||||
.{ "xslt", "application/xslt+xml" },
|
||||
.{ "xul", "application/vnd.mozilla.xul+xml" },
|
||||
.{ "yaml", "application/yaml" },
|
||||
.{ "yml", "application/yaml" },
|
||||
.{ "zip", "application/zip" },
|
||||
.{ "zst", "application/zst" },
|
||||
});
|
||||
@@ -10,6 +10,7 @@ pub const Connection = @import("Connection.zig");
|
||||
pub const FileDescriptor = @import("FileDescriptor.zig").FileDescriptor;
|
||||
pub const http = @import("http.zig");
|
||||
pub const Id = @import("Id.zig").Id;
|
||||
pub const mime = @import("mime.zig");
|
||||
pub const openssl = @import("openssl.zig");
|
||||
pub const Request = @import("Request.zig");
|
||||
pub const RequestHandler = @import("RequestHandler.zig");
|
||||
|
||||
Reference in New Issue
Block a user