MimeTypes 2.5.2
Requires NuGet 3.3 or higher.
dotnet add package MimeTypes --version 2.5.2
NuGet\Install-Package MimeTypes -Version 2.5.2
<PackageReference Include="MimeTypes" Version="2.5.2"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add MimeTypes --version 2.5.2
#r "nuget: MimeTypes, 2.5.2"
// Install MimeTypes as a Cake Addin #addin nuget:?package=MimeTypes&version=2.5.2 // Install MimeTypes as a Cake Tool #tool nuget:?package=MimeTypes&version=2.5.2
MimeTypes
A simple lookup from file name/extension to MIME/media type and vice versa, generated from mime-db, which in turn is compiled from IANA, Apache and nginx's MIME types.
This is a source-only package, containing a single class, MimeTypes
, which will be compiled into your library/application under the root namespace.
Installation
The easiest way to get it, is to install the source package from NuGet.org.
Otherwise you could just pull the source file from GitHub.
Usage
Lookup MIME/media type for a file name/extension
Get the MIME/media type for a file name/extension by using the MimeTypes.TryGetMimeType
or MimeTypes.GetMimeType
methods:
if (MimeTypes.TryGetMimeType("awesome-file.json", out var mimeType))
{
// mimeType == "application/json"
}
MimeTypes.GetMimeType("awesome-file.json"); // "application/json"
When calling GetMimeType
, if a mapping for the given file extension doesn't exist, it will fall back to MimeTypes.FallbackMimeType
, which is set to application/octet-stream
by default.
Lookup file extension by MIME/media type
To get all available file extensions for a MIME/media type, you can call MimeTypes.GetMimeTypeExtensions
. This returns back an IEnumerable<string>
of all the available files types for the specified MIME/media type.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 is compatible. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
This package has no dependencies.
NuGet packages (10)
Showing the top 5 NuGet packages that depend on MimeTypes:
Package | Downloads |
---|---|
Terradue.Stars
Stars is a set of services for working with Spatio Temporal Catalog such as STAC but not only |
|
Terradue.Data.Stars
Collection of data Plugins for Terradue.Stars |
|
magic.io.services
Service implementations for magic.io that allows you to upload and download files to your ASP.NET Core application. To use package go to https://polterguy.github.io |
|
UXAV.AVnet.Core
Package Description |
|
BlazorMobile
BlazorMobile: Launch Blazor as a mobile application on iOS, Android & UWP, with native communication support. Support iOS 12+, Android 4.4 >= and UWP. Install this package on your shared Xamarin.Forms app project. |
GitHub repositories (13)
Showing the top 5 popular GitHub repositories that depend on MimeTypes:
Repository | Stars |
---|---|
jellyfin/jellyfin
The Free Software Media System - Server Backend & API
|
|
master131/iFakeLocation
Simulate locations on iOS devices on Windows, Mac and Ubuntu.
|
|
alxnbl/onenote-md-exporter
ConsoleApp to export OneNote notebooks to Markdown formats
|
|
paillave/Etl.Net
Mass processing data with a complete ETL for .net developers
|
|
NetSparkleUpdater/NetSparkle
NetSparkle is a C#, cross-platform, highly-configurable software update framework with pre-built UI for .NET developers compatible with .NET 4.6.2/.NET 6+, WinForms, WPF, and Avalonia; uses Ed25519 signatures. View basic usage here in the README and try the samples for yourself.
|
Version | Downloads | Last updated |
---|---|---|
2.5.2 | 660,108 | 3/27/2024 |
2.5.1 | 1,960 | 3/26/2024 |
2.5.0 | 280 | 3/26/2024 |
2.4.1 | 1,760,980 | 2/21/2023 |
2.4.0 | 1,487,187 | 3/29/2022 |
2.3.0 | 295,966 | 2/8/2022 |
2.2.1 | 482,459 | 8/24/2021 |
2.2.0 | 378,496 | 2/24/2021 |
2.1.4 | 491 | 8/23/2021 |
2.1.3 | 493 | 4/17/2021 |
2.1.2 | 441 | 4/12/2021 |
2.1.1 | 132,260 | 12/29/2020 |
2.1.0 | 950 | 12/29/2020 |
2.0.2 | 506,803 | 6/16/2020 |
2.0.1 | 49,059 | 5/28/2020 |
2.0.0 | 2,327 | 5/28/2020 |
1.1.0 | 1,428,540 | 9/19/2018 |
1.0.6 | 283,301 | 12/6/2016 |
1.0.5 | 5,058 | 7/13/2015 |
1.0.4 | 26,381 | 6/29/2015 |
1.0.3 | 1,163 | 6/29/2015 |
1.0.2 | 1,753 | 9/7/2014 |
1.0.1 | 1,217 | 9/7/2014 |
1.0.0 | 23,770 | 9/7/2014 |