SimpleMimeMap 1.0.3
dotnet add package SimpleMimeMap --version 1.0.3
NuGet\Install-Package SimpleMimeMap -Version 1.0.3
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="SimpleMimeMap" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SimpleMimeMap" Version="1.0.3" />
<PackageReference Include="SimpleMimeMap" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SimpleMimeMap --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SimpleMimeMap, 1.0.3"
#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.
#addin nuget:?package=SimpleMimeMap&version=1.0.3
#tool nuget:?package=SimpleMimeMap&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SimpleMimeMap
Simple mapping between file extensions and mime types.
The dictionary representing the mapping is automatically populated based on jshttp mime-db.
Install
Usage
using SimpleMime;
var mime = SimpleMimeMap.GetMimeType(".jpeg"); // "image/jpeg"
// Note that an extension can have multiple mime types; mp4 has type application/mp4 when it does not have a video track
var allMimes = SimpleMimeMap.GetMimeTypes("https://example.com/movie.mp4"); // ["application/mp4", "video/mp4"]
// Note that the alphabetically first mime type will be selected if you call GetMimeType
var mime2 = SimpleMimeMap.GetMimeType("mp4"); // "application/mp4"
// Mime types commonly map to multiple file extensions
var exts = SimpleMimeMap.GetExtensions("image/jpeg"); // ["jpg", "jpeg", "jpe"]
// Retrieve the first extension for the mime type
var ext = SimpleMimeMap.GetExtension("image/jpeg"); // "jpg"
// Some other useful methods:
var imageExtensions = SimpleMimeMap.GetImageExtensions(); // ["jpg", "png", ...];
Why this library?
- Programmatic update strategy from an up-to-date source; running the SimpleMimeMap.Updater project will fetch the latest mime maps and update the SimpleMimeMap.cs file
- Handling multiple mime maps per extension
- Allow accessing the dictionary directly for operations not built into the library
License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SimpleMimeMap:
Package | Downloads |
---|---|
ImmediaC.SimpleCms
ASP.NET Core based CMS |
GitHub repositories
This package is not used by any popular GitHub repositories.