\href{https://npmjs.org/package/media-typer}{\texttt{ }} \href{https://npmjs.org/package/media-typer}{\texttt{ }} \href{http://nodejs.org/download/}{\texttt{ }} \href{https://travis-ci.org/jshttp/media-typer}{\texttt{ }} \href{https://coveralls.io/r/jshttp/media-typer}{\texttt{ }}

Simple RFC 6838 media type parser\hypertarget{md_sfcode_node_modules_media_typer_README_autotoc_md17013}{}\doxysection{Installation}\label{md_sfcode_node_modules_media_typer_README_autotoc_md17013}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install media-\/typer }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_media_typer_README_autotoc_md17014}{}\doxysection{API}\label{md_sfcode_node_modules_media_typer_README_autotoc_md17014}

\begin{DoxyCode}{0}
\DoxyCodeLine{var typer = require('media-\/typer') }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_media_typer_README_autotoc_md17015}{}\doxysubsection{typer.\+parse(string)}\label{md_sfcode_node_modules_media_typer_README_autotoc_md17015}

\begin{DoxyCode}{0}
\DoxyCodeLine{var obj = typer.parse('image/svg+xml; charset=utf-\/8') }

\end{DoxyCode}


Parse a media type string. This will return an object with the following properties (examples are shown for the string `\textquotesingle{}image/svg+xml; charset=utf-\/8'\`{})\+:


\begin{DoxyItemize}
\item {\ttfamily type}\+: The type of the media type (always lower case). Example\+: `\textquotesingle{}image'\`{}
\item {\ttfamily subtype}\+: The subtype of the media type (always lower case). Example\+: `\textquotesingle{}svg'\`{}
\item {\ttfamily suffix}\+: The suffix of the media type (always lower case). Example\+: `\textquotesingle{}xml'\`{}
\item {\ttfamily parameters}\+: An object of the parameters in the media type (name of parameter always lower case). Example\+: `\{charset\+: \textquotesingle{}utf-\/8'\}\`{}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_media_typer_README_autotoc_md17016}{}\doxysubsection{typer.\+parse(req)}\label{md_sfcode_node_modules_media_typer_README_autotoc_md17016}

\begin{DoxyCode}{0}
\DoxyCodeLine{var obj = typer.parse(req) }

\end{DoxyCode}


Parse the {\ttfamily content-\/type} header from the given {\ttfamily req}. Short-\/cut for `typer.\+parse(req.\+headers\mbox{[}\textquotesingle{}content-\/type'\mbox{]})\`{}.\hypertarget{md_sfcode_node_modules_media_typer_README_autotoc_md17017}{}\doxysubsection{typer.\+parse(res)}\label{md_sfcode_node_modules_media_typer_README_autotoc_md17017}

\begin{DoxyCode}{0}
\DoxyCodeLine{var obj = typer.parse(res) }

\end{DoxyCode}


Parse the {\ttfamily content-\/type} header set on the given {\ttfamily res}. Short-\/cut for `typer.\+parse(res.\+get\+Header(\textquotesingle{}content-\/type'))\`{}.\hypertarget{md_sfcode_node_modules_media_typer_README_autotoc_md17018}{}\doxysubsection{typer.\+format(obj)}\label{md_sfcode_node_modules_media_typer_README_autotoc_md17018}

\begin{DoxyCode}{0}
\DoxyCodeLine{var obj = typer.format(\{type: 'image', subtype: 'svg', suffix: 'xml'\}) }

\end{DoxyCode}


Format an object into a media type string. This will return a string of the mime type for the given object. For the properties of the object, see the documentation for {\ttfamily typer.\+parse(string)}.\hypertarget{md_sfcode_node_modules_media_typer_README_autotoc_md17019}{}\doxysection{License}\label{md_sfcode_node_modules_media_typer_README_autotoc_md17019}
\mbox{[}MIT\mbox{]}(LICENSE) 