MimeUtils
public enum MimeUtils
Utilities for dealing with MIME types.
-
Returns true if the given case insensitive MIME type has an entry in the map.
Declaration
Swift
public static func hasMimeType(_ mimeType: String) -> Bool
Parameters
mimeType
mimeType A MIME type (i.e. text/plain)
Return Value
Bool
if a extension has been registered for the given case insensitive MIME type. -
Returns the MIME type for the given case insensitive file extension.
Declaration
Swift
public static func mimeType(from fileExtension: String) -> String?
Parameters
fileExtension
A file extension without the leading ‘.’
Return Value
The MIME type has been registered for the given case insensitive file extension or null if there is none.
-
Returns true if the given case insensitive extension has a registered MIME type.
Declaration
Swift
public static func hasExtension(_ fileExtension: String) -> Bool
Parameters
fileExtension
A file extension without the leading ‘.’
Return Value
True if a MIME type has been registered for the given case insensitive file extension.
-
Returns the registered extension for the given case insensitive MIME type. Note that some MIME types map to multiple extensions. This call will return the most common extension for the given MIME type.
Declaration
Swift
public static func fileExtension(from mimeType: String) -> String?
Parameters
mimeType
A MIME type (i.e. text/plain)
Return Value
The extension has been registered for the given case insensitive MIME type or null if there is none.