MimeMapping 1.0.1.50

MimeMapping

Nuget Nuget

Constants for (almost) all MIME types and method to determine MIME type from a file name. Contains just over 1000 mime types.

The Dictionary is generated from the jshttp/mime-db db.json. Works similar to .NET's System.Web.MimeMapping.GetMimeMapping.

It aggregates data from the following sources:

The library is just a literal C# Dictionary<string, string> with over 1000 entries, and a helper method that can be passed a file path.

Example Usage

string myFile = "myimage.jpg";
string mimeType = MimeMapping.MimeUtility.GetMimeMapping(myFile);
Console.WriteLine(mimeType); // output: image/jpeg

string randomFile = "data.asdf";
string mimeType = MimeMapping.MimeUtility.GetMimeMapping(randomFile);
Console.WriteLine(mimeType); // output: application/octet-stream

string rawExtension = "json";
string mimeType = MimeMapping.MimeUtility.GetMimeMapping(rawExtension);
Console.WriteLine(mimeType); // output: application/json


// List all types..
foreach(var kp in MimeMapping.MimeTypes.TypeMap)
{
	Console.WriteLine($"File extension: {kp.Key}, mime string: {kp.Value}");
}

Showing the top 20 packages that depend on MimeMapping.

Packages Downloads
Squidex.ClientLibrary
ClientLibrary for Squidex Headless CMS
28
Squidex.ClientLibrary
ClientLibrary for Squidex Headless CMS
26
Squidex.ClientLibrary
ClientLibrary for Squidex Headless CMS
25
Squidex.ClientLibrary
ClientLibrary for Squidex Headless CMS
22
Squidex.ClientLibrary
ClientLibrary for Squidex Headless CMS
21
Squidex.ClientLibrary
ClientLibrary for Squidex Headless CMS
18

.NET Standard 1.1

.NET Standard 2.0

  • No dependencies.

.NET Standard 2.1

  • No dependencies.

Version Downloads Last updated
3.1.0 20 12/14/2024
3.0.1 28 02/15/2024
3.0.0 27 02/15/2024
2.1.0 28 02/15/2024
2.0.0 17 01/19/2024
1.0.1.50 13 01/18/2024
1.0.1.37 25 01/18/2024
1.0.1.35 17 01/19/2024
1.0.1.30 19 01/19/2024
1.0.1.26 18 01/18/2024
1.0.1.21 16 01/19/2024
1.0.1.17 19 01/19/2024
1.0.1.15 13 01/18/2024
1.0.1.14 19 01/21/2024
1.0.1.12 17 01/18/2024
1.0.1.10 17 01/20/2024
0.1.6 21 01/18/2024
0.1.5.9 18 01/20/2024
0.1.5 19 01/19/2024
0.1.4 11 01/20/2024
0.1.3 18 01/18/2024
0.1.2 14 01/20/2024
0.1.1 16 01/18/2024
0.1.0 18 01/18/2024