BogaNet 1.4.0
Loading...
Searching...
No Matches
Static Public Member Functions | Static Protected Attributes | List of all members
BogaNet.Util.MimeTypeMap Class Referenceabstract

MIME type mapper. Based on: https://github.com/samuelneff/MimeTypeMap. More...

Static Public Member Functions

static bool TryGetMimeType (string file, out string mimeType)
 Tries to get the type of the MIME from the provided string.
 
static string GetMimeType (string file)
 Gets the type of the MIME from the provided string.
 
static bool TryGetExtension (string mimeType, out string extension)
 Tries to get the file extension from the provided MIME type.
 
static string GetExtension (string mimeType)
 Gets the file extension from the provided MIME type.
 

Static Protected Attributes

static readonly Lazy< IDictionary< string, string > > _mappings = new(buildMappings)
 

Detailed Description

MIME type mapper. Based on: https://github.com/samuelneff/MimeTypeMap.

Member Function Documentation

◆ GetExtension()

static string BogaNet.Util.MimeTypeMap.GetExtension ( string mimeType)
static

Gets the file extension from the provided MIME type.

Parameters
mimeTypeMIME type
Returns
The extension for the MIME type
Exceptions
ArgumentNullException

◆ GetMimeType()

static string BogaNet.Util.MimeTypeMap.GetMimeType ( string file)
static

Gets the type of the MIME from the provided string.

Parameters
fileThe filename or extension
Returns
The MIME type

◆ TryGetExtension()

static bool BogaNet.Util.MimeTypeMap.TryGetExtension ( string mimeType,
out string extension )
static

Tries to get the file extension from the provided MIME type.

Parameters
mimeTypeMIME type
extensionThe variable to store the file extension
Returns
True if the operation was successful
Exceptions
ArgumentNullException

◆ TryGetMimeType()

static bool BogaNet.Util.MimeTypeMap.TryGetMimeType ( string file,
out string mimeType )
static

Tries to get the type of the MIME from the provided string.

Parameters
fileThe filename or extension
mimeTypeThe variable to store the MIME type
Returns
True if the operation was successful

Member Data Documentation

◆ _mappings

readonly Lazy<IDictionary<string, string> > BogaNet.Util.MimeTypeMap._mappings = new(buildMappings)
staticprotected

The documentation for this class was generated from the following file: