Class MimeTypes

Namespace
Cratis.Arc.Http
Assembly
Cratis.Arc.Core.dll

Provides MIME type mappings for common file extensions.

public static class MimeTypes
Inheritance
MimeTypes
Inherited Members

Methods

AddMapping(string, string)

Adds a custom MIME type mapping.

public static void AddMapping(string extension, string mimeType)

Parameters

extension string

The file extension (with or without leading dot).

mimeType string

The MIME type.

AddMappings(IEnumerable<KeyValuePair<string, string>>)

Adds multiple custom MIME type mappings.

public static void AddMappings(IEnumerable<KeyValuePair<string, string>> mappings)

Parameters

mappings IEnumerable<KeyValuePair<string, string>>

The mappings to add.

GetMimeType(string)

Gets the MIME type for a given file extension.

public static string GetMimeType(string extension)

Parameters

extension string

The file extension (with or without leading dot).

Returns

string

The MIME type, or "application/octet-stream" if unknown.

GetMimeTypeFromPath(string)

Gets the MIME type for a given file path.

public static string GetMimeTypeFromPath(string filePath)

Parameters

filePath string

The file path.

Returns

string

The MIME type, or "application/octet-stream" if unknown.