Comprehensive MIME type mapping API based on mime-\/db module.\hypertarget{md_sfcode_node_modules_mime_README_autotoc_md17284}{}\doxysection{Install}\label{md_sfcode_node_modules_mime_README_autotoc_md17284}
Install with \href{http://github.com/isaacs/npm}{\texttt{ npm}}\+: \begin{DoxyVerb}npm install mime
\end{DoxyVerb}
 \hypertarget{md_sfcode_node_modules_mime_README_autotoc_md17285}{}\doxysection{Contributing / Testing}\label{md_sfcode_node_modules_mime_README_autotoc_md17285}
\begin{DoxyVerb}npm run test
\end{DoxyVerb}
 \hypertarget{md_sfcode_node_modules_mime_README_autotoc_md17286}{}\doxysection{Command Line}\label{md_sfcode_node_modules_mime_README_autotoc_md17286}
\begin{DoxyVerb}mime [path_string]
\end{DoxyVerb}
 E.\+g. \begin{DoxyVerb}> mime scripts/jquery.js
application/javascript
\end{DoxyVerb}
 \hypertarget{md_sfcode_node_modules_mime_README_autotoc_md17287}{}\doxysection{API -\/ Queries}\label{md_sfcode_node_modules_mime_README_autotoc_md17287}
\hypertarget{md_sfcode_node_modules_mime_README_autotoc_md17288}{}\doxysubsection{mime.\+lookup(path)}\label{md_sfcode_node_modules_mime_README_autotoc_md17288}
Get the mime type associated with a file, if no mime type is found {\ttfamily application/octet-\/stream} is returned. Performs a case-\/insensitive lookup using the extension in {\ttfamily path} (the substring after the last \textquotesingle{}/\textquotesingle{} or \textquotesingle{}.\textquotesingle{}). E.\+g.


\begin{DoxyCode}{0}
\DoxyCodeLine{var mime = require('mime');}
\DoxyCodeLine{}
\DoxyCodeLine{mime.lookup('/path/to/file.txt');         // => 'text/plain'}
\DoxyCodeLine{mime.lookup('file.txt');                  // => 'text/plain'}
\DoxyCodeLine{mime.lookup('.TXT');                      // => 'text/plain'}
\DoxyCodeLine{mime.lookup('htm');                       // => 'text/html' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_mime_README_autotoc_md17289}{}\doxysubsection{mime.\+default\+\_\+type}\label{md_sfcode_node_modules_mime_README_autotoc_md17289}
Sets the mime type returned when {\ttfamily mime.\+lookup} fails to find the extension searched for. (Default is {\ttfamily application/octet-\/stream}.)\hypertarget{md_sfcode_node_modules_mime_README_autotoc_md17290}{}\doxysubsection{mime.\+extension(type)}\label{md_sfcode_node_modules_mime_README_autotoc_md17290}
Get the default extension for {\ttfamily type}


\begin{DoxyCode}{0}
\DoxyCodeLine{mime.extension('text/html');                 // => 'html'}
\DoxyCodeLine{mime.extension('application/octet-\/stream');  // => 'bin' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_mime_README_autotoc_md17291}{}\doxysubsection{mime.\+charsets.\+lookup()}\label{md_sfcode_node_modules_mime_README_autotoc_md17291}
Map mime-\/type to charset


\begin{DoxyCode}{0}
\DoxyCodeLine{mime.charsets.lookup('text/plain');        // => 'UTF-\/8' }

\end{DoxyCode}


(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.)\hypertarget{md_sfcode_node_modules_mime_README_autotoc_md17292}{}\doxysection{API -\/ Defining Custom Types}\label{md_sfcode_node_modules_mime_README_autotoc_md17292}
Custom type mappings can be added on a per-\/project basis via the following APIs.\hypertarget{md_sfcode_node_modules_mime_README_autotoc_md17293}{}\doxysubsection{mime.\+define()}\label{md_sfcode_node_modules_mime_README_autotoc_md17293}
Add custom mime/extension mappings


\begin{DoxyCode}{0}
\DoxyCodeLine{mime.define(\{}
\DoxyCodeLine{    'text/x-\/some-\/format': ['x-\/sf', 'x-\/sft', 'x-\/sfml'],}
\DoxyCodeLine{    'application/x-\/my-\/type': ['x-\/mt', 'x-\/mtt'],}
\DoxyCodeLine{    // etc ...}
\DoxyCodeLine{\});}
\DoxyCodeLine{}
\DoxyCodeLine{mime.lookup('x-\/sft');                 // => 'text/x-\/some-\/format' }

\end{DoxyCode}


The first entry in the extensions array is returned by {\ttfamily mime.\+extension()}. E.\+g.


\begin{DoxyCode}{0}
\DoxyCodeLine{mime.extension('text/x-\/some-\/format'); // => 'x-\/sf' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_mime_README_autotoc_md17294}{}\doxysubsection{mime.\+load(filepath)}\label{md_sfcode_node_modules_mime_README_autotoc_md17294}
Load mappings from an Apache \char`\"{}.\+types\char`\"{} format file


\begin{DoxyCode}{0}
\DoxyCodeLine{mime.load('./my\_project.types'); }

\end{DoxyCode}
 The .types file format is simple -\/ See the {\ttfamily types} dir for examples. 