Mime
Introduced in 4.1.0
Stability: 2 - Stable
const Mime = require('kado/lib/Mime')
The Mime
library helps determine Mime Types by using either the path to a file and
then its file extension. Optionally, a {Buffer} which Mime will check magically
and try to determine a file. File extensions are recommended as a primary lookup method
and must include only a .
and then extension such as .txt
for a lookup. When
no extension is available it is possible to read the first few bytes from the file
and pass that Buffer to Mime
to determine the type.
Class: Mime
static Mime.getType(input)
input
{string|Buffer} the portion provided to determine file type.- Return {MimeType|null} a new instance of a MimeType class populated with the matched type,
otherwise
null
when no type is matched.