Provides a mechanism for guessing the MIME type of a file by its extension. Of course, this isn't perfect - magic bytes are probably more reliable - but also more effort. This code is largely copied from https://github.com/samuelneff/MimeTypeMap/blob/master/MimeTypeMap.cs The code in this file is licensed under the.
More...
|
static string | GuessForFileName (string fileNameOrExtension) |
| Tries to get the type of the MIME from the provided string.
|
static bool | TryGuessExtensionForMimeType (string mimeType, out string extension) |
| Gets the extension from the provided MINE type.
|
static bool | IsTextMimeType (this string mimeType) |
| Returns true for all text mime types: text/* */xml *+xml.
|
|
static string[] | KnownFileExtensions [get] |
| A list of all known file extensions for MIMEType.
|
static string[] | KnownMimeTypes [get] |
| A list of all known MIME types for MIMEType.
|
Provides a mechanism for guessing the MIME type of a file by its extension. Of course, this isn't perfect - magic bytes are probably more reliable - but also more effort. This code is largely copied from https://github.com/samuelneff/MimeTypeMap/blob/master/MimeTypeMap.cs The code in this file is licensed under the.
◆ GuessForFileName()
string PeanutButter.Utils.MimeTypes.GuessForFileName |
( |
string | fileNameOrExtension | ) |
|
|
static |
Tries to get the type of the MIME from the provided string.
- Parameters
-
fileNameOrExtension | The filename or extension. |
- Returns
- The MIME type.
- Exceptions
-
◆ IsTextMimeType()
bool PeanutButter.Utils.MimeTypes.IsTextMimeType |
( |
this string | mimeType | ) |
|
|
static |
Returns true for all text mime types: text/* */xml *+xml.
- Parameters
-
- Returns
◆ TryGuessExtensionForMimeType()
bool PeanutButter.Utils.MimeTypes.TryGuessExtensionForMimeType |
( |
string | mimeType, |
|
|
out string | extension ) |
|
static |
Gets the extension from the provided MINE type.
- Parameters
-
mimeType | Type of the MIME. |
extension | The resolved extension, if found. |
- Exceptions
-
ArgumentNullException | - Exceptions
-
|
The documentation for this class was generated from the following file:
- source/Utils/PeanutButter.Utils/MimeTypes.cs