Method
from(fileExtension:)
Determines the MIME type from a file extension.
static func from(fileExtension ext: String) -> MIMEType
Return Value
The corresponding MIME type, or MIMEType.octetStream if the extension is not recognised.
Discussion
This method performs case-insensitive matching of file extensions to MIME types. Extensions without a leading dot are expected.
Example
let htmlType = MIMEType.from(fileExtension: "html")
// Returns: .html ("text/html; charset=utf-8")
let pngType = MIMEType.from(fileExtension: "PNG")
// Returns: .png ("image/png") - case insensitive
let unknownType = MIMEType.from(fileExtension: "xyz")
// Returns: .octetStream ("application/octet-stream")