MimeMapping 4.0.0

MimeMapping

Nuget Nuget build codecov

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}");
}

//Just use a constant if you already know the file type (performance)
const string mimeType = MimeMapping.KnownMimeTypes.Xlsx

Showing the top 20 packages that depend on MimeMapping.

Packages Downloads
ERP4.Standard.ERechnung
Hiflsfunktionen für ERechnungs erstellung / bearbeitung
20
ERP4.Standard.ERechnung
Hiflsfunktionen für ERechnungs erstellung / bearbeitung
15
ERP4.Standard.ERechnung
Hiflsfunktionen für ERechnungs erstellung / bearbeitung
14
ERP4.Standard.ERechnung
Hiflsfunktionen für ERechnungs erstellung / bearbeitung
13
ERP4.Standard.ERechnung
Hiflsfunktionen für ERechnungs erstellung / bearbeitung
12
ERP4.Standard.ERechnung
Hiflsfunktionen für ERechnungs erstellung / bearbeitung
10
ERP4.Standard.ERechnung
Hiflsfunktionen für ERechnungs erstellung / bearbeitung
8
ERP4.Standard.ERechnung
Hiflsfunktionen für ERechnungs erstellung / bearbeitung
7
ERP4.Standard.ERechnung
Hiflsfunktionen für ERechnungs erstellung / bearbeitung
6
ERP4.Standard.ERechnung
Hiflsfunktionen für ERechnungs erstellung / bearbeitung
5

.NET Framework 4.6.2

  • No dependencies.

.NET Standard 2.0

  • No dependencies.

Version Downloads Last updated
4.0.0 5 02/22/2026
3.2.0 5 02/22/2026
3.1.0 11 03/12/2025
3.0.1 14 01/23/2025
3.0.0 11 03/12/2025
2.1.0 11 03/12/2025
2.0.0 11 03/12/2025
1.0.1.50 10 03/12/2025
1.0.1.37 11 03/12/2025
1.0.1.35 11 03/12/2025
1.0.1.30 11 03/12/2025
1.0.1.26 11 03/12/2025
1.0.1.21 11 03/12/2025
1.0.1.17 11 03/12/2025
1.0.1.15 11 03/12/2025
1.0.1.14 11 03/12/2025
1.0.1.12 11 03/12/2025
1.0.1.10 10 03/12/2025
0.1.6 11 03/12/2025
0.1.5.9 11 03/12/2025
0.1.5 11 03/12/2025
0.1.4 11 03/12/2025
0.1.3 11 03/12/2025
0.1.2 11 03/12/2025
0.1.1 11 03/12/2025
0.1.0 11 03/12/2025