Version: v0.8.1 - Beta.  We welcome contributors & feedback.

File.extensionToMimeType

File.extensionToMimeType($fileExtension) -> string

Description

Infer the MIME type for the given file extension.

If the MIME type is unknown, it returns 'application/octet-stream'.

File.extensionToMimeType('png')
//= 'image/png'

File.extensionToMimeType('htm')
//= 'text/html'

File.extensionToMimeType('xyz')
//= 'application/octet-stream'

See Also