Skip to content

Instantly share code, notes, and snippets.

@markwhitaker
Last active December 29, 2023 16:42
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save markwhitaker/b29c0142360714688a7cf863ab33e5c9 to your computer and use it in GitHub Desktop.
Save markwhitaker/b29c0142360714688a7cf863ab33e5c9 to your computer and use it in GitHub Desktop.
Standard MIME type constants ready to use in a C# project. Now a NuGet package: see https://github.com/markwhitaker/MimeTypes.NET
public static class MimeTypes
{
public static class Application
{
public const string AtomXml = "application/atom+xml";
public const string AtomcatXml = "application/atomcat+xml";
public const string Ecmascript = "application/ecmascript";
public const string JavaArchive = "application/java-archive";
public const string Javascript = "application/javascript";
public const string Json = "application/json";
public const string Mp4 = "application/mp4";
public const string OctetStream = "application/octet-stream";
public const string Pdf = "application/pdf";
public const string Pkcs10 = "application/pkcs10";
public const string Pkcs7Mime = "application/pkcs7-mime";
public const string Pkcs7Signature = "application/pkcs7-signature";
public const string Pkcs8 = "application/pkcs8";
public const string Postscript = "application/postscript";
public const string RdfXml = "application/rdf+xml";
public const string RssXml = "application/rss+xml";
public const string Rtf = "application/rtf";
public const string SmilXml = "application/smil+xml";
public const string XFontOtf = "application/x-font-otf";
public const string XFontTtf = "application/x-font-ttf";
public const string XFontWoff = "application/x-font-woff";
public const string XPkcs12 = "application/x-pkcs12";
public const string XShockwaveFlash = "application/x-shockwave-flash";
public const string XSilverlightApp = "application/x-silverlight-app";
public const string XhtmlXml = "application/xhtml+xml";
public const string Xml = "application/xml";
public const string XmlDtd = "application/xml-dtd";
public const string XsltXml = "application/xslt+xml";
public const string Zip = "application/zip";
}
public static class Audio
{
public const string Midi = "audio/midi";
public const string Mp4 = "audio/mp4";
public const string Mpeg = "audio/mpeg";
public const string Ogg = "audio/ogg";
public const string Webm = "audio/webm";
public const string XAac = "audio/x-aac";
public const string XAiff = "audio/x-aiff";
public const string XMpegurl = "audio/x-mpegurl";
public const string XMsWma = "audio/x-ms-wma";
public const string XWav = "audio/x-wav";
}
public static class Image
{
public const string Bmp = "image/bmp";
public const string Gif = "image/gif";
public const string Jpeg = "image/jpeg";
public const string Png = "image/png";
public const string SvgXml = "image/svg+xml";
public const string Tiff = "image/tiff";
public const string Webp = "image/webp";
}
public static class Text
{
public const string Css = "text/css";
public const string Csv = "text/csv";
public const string Html = "text/html";
public const string Plain = "text/plain";
public const string RichText = "text/richtext";
public const string Sgml = "text/sgml";
public const string Yaml = "text/yaml";
}
public static class Video
{
public const string Threegpp = "video/3gpp";
public const string H264 = "video/h264";
public const string Mp4 = "video/mp4";
public const string Mpeg = "video/mpeg";
public const string Ogg = "video/ogg";
public const string Quicktime = "video/quicktime";
public const string Webm = "video/webm";
}
}
MIT License
Copyright (c) 2017 Mark Whitaker
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@douglasg14b
Copy link

Nice! This could use a license though...

@markwhitaker
Copy link
Author

Nice! This could use a license though...

It’s just a gist. Use it however you like!

@douglasg14b
Copy link

douglasg14b commented Aug 7, 2019

@markwhitaker

Unfortunately gists cannot be used in compliant codebases if that code doesn't have a license that permits i, or expressed permission from the owner. No license essentially means it's under your exclusive copyright, and no one has permission to use or modify it without your expressed permission (which you have provided).

Just a heads up!

@gear3g
Copy link

gear3g commented Oct 13, 2019

Excellent! you should submit a Pull-request to the .Net repo

@douglasg14b
Copy link

@markwhitaker
Copy link
Author

Thanks for all the interest in this gist. I decided to upgrade it to a NuGet package - see https://github.com/markwhitaker/MimeTypes.NET.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment