MimeMapping 1.0.1.50
MimeMapping
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:
- https://www.iana.org/assignments/media-types/media-types.xhtml
- https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
- https://hg.nginx.org/nginx/raw-file/default/conf/mime.types
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 |
---|---|
Supabase.Storage
A C# implementation of the Supabase Storage client
|
6 |
supabase-csharp
A C# implementation of the Supabase client
|
1 |
supabase-storage-csharp
A C# implementation of the Supabase Storage client
|
1 |
.NET Standard 1.1
- NETStandard.Library (>= 1.6.1)
.NET Standard 2.0
- No dependencies.
.NET Standard 2.1
- No dependencies.
Version | Downloads | Last updated |
---|---|---|
3.1.0 | 0 | 12/09/2024 |
3.0.1 | 8 | 05/08/2024 |
3.0.0 | 3 | 05/07/2024 |
2.1.0 | 3 | 05/08/2024 |
2.0.0 | 4 | 05/15/2024 |
1.0.1.50 | 1 | 05/08/2024 |
1.0.1.37 | 1 | 05/08/2024 |
1.0.1.35 | 1 | 05/07/2024 |
1.0.1.30 | 1 | 05/07/2024 |
1.0.1.26 | 7 | 02/26/2024 |
1.0.1.21 | 1 | 05/08/2024 |
1.0.1.17 | 3 | 05/07/2024 |
1.0.1.15 | 1 | 05/08/2024 |
1.0.1.14 | 2 | 05/08/2024 |
1.0.1.12 | 2 | 05/08/2024 |
1.0.1.10 | 1 | 05/08/2024 |
0.1.6 | 1 | 05/08/2024 |
0.1.5.9 | 2 | 05/08/2024 |
0.1.5 | 1 | 05/08/2024 |
0.1.4 | 1 | 05/07/2024 |
0.1.3 | 1 | 05/19/2024 |
0.1.2 | 1 | 05/08/2024 |
0.1.1 | 2 | 05/14/2024 |
0.1.0 | 3 | 05/08/2024 |