Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aptacode/mimetypelib
A lightweight C# dotnet standard library containing a huge list of MimeTypes + compatible File Extensions
https://github.com/aptacode/mimetypelib
aptacode csharp dotnet dotnet-core dotnet-standard mimetypes static-mimetypes
Last synced: 4 days ago
JSON representation
A lightweight C# dotnet standard library containing a huge list of MimeTypes + compatible File Extensions
- Host: GitHub
- URL: https://github.com/aptacode/mimetypelib
- Owner: Aptacode
- License: mit
- Created: 2020-03-30T19:09:33.000Z (over 4 years ago)
- Default Branch: Development
- Last Pushed: 2022-12-08T10:10:39.000Z (about 2 years ago)
- Last Synced: 2024-12-01T22:18:18.864Z (21 days ago)
- Topics: aptacode, csharp, dotnet, dotnet-core, dotnet-standard, mimetypes, static-mimetypes
- Language: C#
- Homepage: https://aptacode.com
- Size: 403 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
A lightweight C# .net standard library containing a growing list of over 900 mimetypes and 1600 compatible extensions.[![NuGet](https://img.shields.io/nuget/v/Aptacode.MimeTypes.svg?style=flat)](https://www.nuget.org/packages/Aptacode.MimeTypes/)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/b4609c326d674acd98de15432bc5f69a)](https://www.codacy.com/manual/Timmoth/Aptacode.MimeTypes?utm_source=github.com&utm_medium=referral&utm_content=Timmoth/Aptacode.MimeTypes&utm_campaign=Badge_Grade)
![last commit](https://img.shields.io/github/last-commit/Timmoth/Aptacode.MimeTypes?style=flat-square&cacheSeconds=86000)### Usage
```csharp
#using Aptacode.MimeTypes;
public void Demo(){
var mimeType = MimeTypes.Application.Json;//Get a MimeTypevar typeName = mimeType.Type; //"application"
var subTypeName = mimeType.Subtype; //"json"
var toString = mimeType.ToString; //"application/json"var allMimeTypes = MimeTypes.All(); //Returns all available MimeTypes
var filteredMimeTypes = MimeTypes.All(".jpg"); //Returns all MimeTypes with the given extensionvar allExtensions = MimeTypes.Extensions.All(); //Returns all available Extensions
var filteredExtensions = MimeTypes.Extensions.All(MimeTypes.Application.Json); //Returns all available Extensions for the given MimeType
}```
### Adding MimeTypes
The main library is generated from a text file containing a list of MimeTypes, users can modify the list, build & run the SourceCodeGenerator project and then overwrite 'MimeTypeGroups.cs' and 'MimeTypeExtensions.cs' using the generated files to add statically typed MimeTypes to the library.
https://github.com/Timmoth/Aptacode.MimeTypes/blob/master/CodeGenerator/mimetypes.txtAlternatively users can modify add new MimeTypes & modify existing ones at runtime using the static MimeTypes class.