\href{https://npmjs.org/package/mime-types}{\texttt{ }} \href{https://npmjs.org/package/mime-types}{\texttt{ }} \href{https://nodejs.org/en/download}{\texttt{ }} \href{https://travis-ci.org/jshttp/mime-types}{\texttt{ }} \href{https://coveralls.io/r/jshttp/mime-types?branch=master}{\texttt{ }}

The ultimate javascript content-\/type utility.

Similar to \href{https://www.npmjs.com/package/mime}{\texttt{ the {\ttfamily mime@1.\+x} module}}, except\+:


\begin{DoxyItemize}
\item {\bfseries{No fallbacks.}} Instead of naively returning the first available type, {\ttfamily mime-\/types} simply returns {\ttfamily false}, so do `var type = mime.\+lookup(\textquotesingle{}unrecognized') $\vert$$\vert$ \textquotesingle{}application/octet-\/stream\textquotesingle{}{\ttfamily .}
\item {\ttfamily No}new Mime(){\ttfamily business, so you could do}var lookup = require(\textquotesingle{}mime-\/types\textquotesingle{}).lookup{\ttfamily .}
\item {\ttfamily No}.define(){\ttfamily functionality}
\item {\ttfamily Bug fixes for}.lookup(path)\`{}
\end{DoxyItemize}

Otherwise, the API is compatible with {\ttfamily mime} 1.\+x.\hypertarget{md_sfcode_node_modules_mime_types_README_autotoc_md17401}{}\doxysection{Install}\label{md_sfcode_node_modules_mime_types_README_autotoc_md17401}
This is a \href{https://nodejs.org/en/}{\texttt{ Node.\+js}} module available through the \href{https://www.npmjs.com/}{\texttt{ npm registry}}. Installation is done using the \href{https://docs.npmjs.com/getting-started/installing-npm-packages-locally}{\texttt{ {\ttfamily npm install} command}}\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install mime-\/types }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_mime_types_README_autotoc_md17402}{}\doxysection{Adding Types}\label{md_sfcode_node_modules_mime_types_README_autotoc_md17402}
All mime types are based on \href{https://www.npmjs.com/package/mime-db}{\texttt{ mime-\/db}}, so open a PR there if you\textquotesingle{}d like to add mime types.\hypertarget{md_sfcode_node_modules_mime_types_README_autotoc_md17403}{}\doxysection{API}\label{md_sfcode_node_modules_mime_types_README_autotoc_md17403}

\begin{DoxyCode}{0}
\DoxyCodeLine{var mime = require('mime-\/types') }

\end{DoxyCode}


All functions return {\ttfamily false} if input is invalid or not found.\hypertarget{md_sfcode_node_modules_mime_types_README_autotoc_md17404}{}\doxysubsection{mime.\+lookup(path)}\label{md_sfcode_node_modules_mime_types_README_autotoc_md17404}
Lookup the content-\/type associated with a file.


\begin{DoxyCode}{0}
\DoxyCodeLine{mime.lookup('json') // 'application/json'}
\DoxyCodeLine{mime.lookup('.md') // 'text/markdown'}
\DoxyCodeLine{mime.lookup('file.html') // 'text/html'}
\DoxyCodeLine{mime.lookup('folder/file.js') // 'application/javascript'}
\DoxyCodeLine{mime.lookup('folder/.htaccess') // false}
\DoxyCodeLine{}
\DoxyCodeLine{mime.lookup('cats') // false }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_mime_types_README_autotoc_md17405}{}\doxysubsection{mime.\+content\+Type(type)}\label{md_sfcode_node_modules_mime_types_README_autotoc_md17405}
Create a full content-\/type header given a content-\/type or extension. When given an extension, {\ttfamily mime.\+lookup} is used to get the matching content-\/type, otherwise the given content-\/type is used. Then if the content-\/type does not already have a {\ttfamily charset} parameter, {\ttfamily mime.\+charset} is used to get the default charset and add to the returned content-\/type.


\begin{DoxyCode}{0}
\DoxyCodeLine{mime.contentType('markdown') // 'text/x-\/markdown; charset=utf-\/8'}
\DoxyCodeLine{mime.contentType('file.json') // 'application/json; charset=utf-\/8'}
\DoxyCodeLine{mime.contentType('text/html') // 'text/html; charset=utf-\/8'}
\DoxyCodeLine{mime.contentType('text/html; charset=iso-\/8859-\/1') // 'text/html; charset=iso-\/8859-\/1'}
\DoxyCodeLine{}
\DoxyCodeLine{// from a full path}
\DoxyCodeLine{mime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-\/8' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_mime_types_README_autotoc_md17406}{}\doxysubsection{mime.\+extension(type)}\label{md_sfcode_node_modules_mime_types_README_autotoc_md17406}
Get the default extension for a content-\/type.


\begin{DoxyCode}{0}
\DoxyCodeLine{mime.extension('application/octet-\/stream') // 'bin' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_mime_types_README_autotoc_md17407}{}\doxysubsection{mime.\+charset(type)}\label{md_sfcode_node_modules_mime_types_README_autotoc_md17407}
Lookup the implied default charset of a content-\/type.


\begin{DoxyCode}{0}
\DoxyCodeLine{mime.charset('text/markdown') // 'UTF-\/8' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_mime_types_README_autotoc_md17408}{}\doxysubsection{var type = mime.\+types\mbox{[}extension\mbox{]}}\label{md_sfcode_node_modules_mime_types_README_autotoc_md17408}
A map of content-\/types by extension.\hypertarget{md_sfcode_node_modules_mime_types_README_autotoc_md17409}{}\doxysubsection{\mbox{[}extensions...\mbox{]} = mime.\+extensions\mbox{[}type\mbox{]}}\label{md_sfcode_node_modules_mime_types_README_autotoc_md17409}
A map of extensions by content-\/type.\hypertarget{md_sfcode_node_modules_mime_types_README_autotoc_md17410}{}\doxysection{License}\label{md_sfcode_node_modules_mime_types_README_autotoc_md17410}
\mbox{[}MIT\mbox{]}(LICENSE) 