https://github.com/folkerkinzel/mimetypes
.NET Library that supports working with Internet Media Types ("MIME Types")
https://github.com/folkerkinzel/mimetypes
Last synced: 3 months ago
JSON representation
.NET Library that supports working with Internet Media Types ("MIME Types")
- Host: GitHub
- URL: https://github.com/folkerkinzel/mimetypes
- Owner: FolkerKinzel
- License: mit
- Created: 2021-08-04T08:55:44.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-10T19:33:27.000Z (about 1 year ago)
- Last Synced: 2024-04-11T14:25:56.382Z (about 1 year ago)
- Language: C#
- Homepage:
- Size: 9.04 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FolkerKinzel.MimeTypes
[](https://www.nuget.org/packages/FolkerKinzel.MimeTypes/)
[](https://github.com/FolkerKinzel/MimeTypes/blob/master/LICENSE)
[](https://stand-with-ukraine.pp.ua)## .NET Library that supports working with Internet Media Types ("MIME Types")
[Project Reference](https://folkerkinzel.github.io/MimeTypes/reference/)
- The static `MimeString` class works on strings and allows to convert file names into Internet Media Types ("MIME types") or Internet Media Types into appropriate file type extensions.
- The `MimeType` class allows:
- Building instances from scratch using a fluent API,
- Parsing and validating Internet Media Types,
- Editing Internet Media Type parameters,
- Serializing Internet Media Types as strings according to the standards (see [RFC 2045](https://datatracker.ietf.org/doc/html/rfc2045#section-5.1) and [RFC 2231](https://datatracker.ietf.org/doc/html/rfc2231.html)) using several formatting options,
- Retrieving a file type extension.
- The `MimeTypeInfo` struct allows memory efficient parsing, validating, and reformatting of Internet Media Type strings and allows to retrieve an appropriate file type extension.The library is designed to support performance and small heap allocation.
The data for the file type extension parser is collected from:
1. [Apache](https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types)
2. [jshttp/mime-db](https://github.com/jshttp/mime-db)
2. own research.(The collected data was considered in the specified order. Have a detailed explanation about how this data is ordered and compiled in
the comments of [MimeResourceCompiler](https://github.com/FolkerKinzel/MimeTypes/blob/master/src/MimeResourceCompiler/Program.cs), which is
part of this repository.)[Version History](https://github.com/FolkerKinzel/MimeTypes/releases)
### Code Examples
1. [Getting an Internet Media Type ("MIME type") string from a file type extension and vice versa](https://github.com/FolkerKinzel/MimeTypes/blob/master/src/Examples/FileExtensionExample.cs)
2. [Building, serializing, parsing, and editing of MimeType instances](https://github.com/FolkerKinzel/MimeTypes/blob/master/src/Examples/BuildAndParseExample.cs)
3. [Formatting a MimeType instance into a standards-compliant string using several options](https://github.com/FolkerKinzel/MimeTypes/blob/master/src/Examples/FormattingOptionsExample.cs)
4. [Comparison of MimeType instances](https://github.com/FolkerKinzel/MimeTypes/blob/master/src/Examples/EqualityExample.cs)
5. [Efficient parsing of an Internet Media Type String](https://github.com/FolkerKinzel/MimeTypes/blob/master/src/Examples/MimeTypeInfoExample.cs)