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                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MimeTypes" Version="2.5.2">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MimeTypes --version 2.5.2                
#r "nuget: MimeTypes, 2.5.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
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 545,608 3/27/2024
2.5.1 1,851 3/26/2024
2.5.0 270 3/26/2024
2.4.1 1,673,533 2/21/2023
2.4.0 1,455,048 3/29/2022
2.3.0 292,588 2/8/2022
2.2.1 474,916 8/24/2021
2.2.0 374,559 2/24/2021
2.1.4 482 8/23/2021
2.1.3 486 4/17/2021
2.1.2 433 4/12/2021
2.1.1 131,502 12/29/2020
2.1.0 943 12/29/2020
2.0.2 505,215 6/16/2020
2.0.1 48,347 5/28/2020
2.0.0 2,166 5/28/2020
1.1.0 1,413,526 9/19/2018
1.0.6 280,312 12/6/2016
1.0.5 5,043 7/13/2015
1.0.4 25,983 6/29/2015
1.0.3 1,149 6/29/2015
1.0.2 1,735 9/7/2014
1.0.1 1,205 9/7/2014
1.0.0 20,051 9/7/2014