mime library
Help for working with file format identifiers
such as text/html
and image/png
.
More details, including a list of types, are in the Wikipedia article Internet media type. For information on installing and importing this library, see the mime package on pub.dartlang.org.
Properties
Functions
String lookupMimeType(String path, {List<int> headerBytes}) #
Extract the extension from path and use that for MIME-type lookup, using the default extension map.
If no matching MIME-type was found, null
is returned.
If headerBytes is present, a match for known magic-numbers will be performed first. This allows the correct mime-type to be found, even though a file have been saved using the wrong file-name extension. If less than defaultMagicNumbersMaxLength bytes was provided, some magic-numbers won't be matched against.
String lookupMimeType(String path, {List<int> headerBytes}) => _globalResolver.lookup(path, headerBytes: headerBytes);