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

Create and parse HTTP Content-\/\+Type header according to RFC 7231\hypertarget{md_sfcode_node_modules_content_type_README_autotoc_md6514}{}\doxysection{Installation}\label{md_sfcode_node_modules_content_type_README_autotoc_md6514}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install content-\/type }

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

\begin{DoxyCode}{0}
\DoxyCodeLine{var contentType = require('content-\/type') }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_content_type_README_autotoc_md6516}{}\doxysubsection{content\+Type.\+parse(string)}\label{md_sfcode_node_modules_content_type_README_autotoc_md6516}

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

\end{DoxyCode}


Parse a content 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 media type (the type and subtype, always lower case). Example\+: `\textquotesingle{}image/svg+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}

Throws a {\ttfamily Type\+Error} if the string is missing or invalid.\hypertarget{md_sfcode_node_modules_content_type_README_autotoc_md6517}{}\doxysubsection{content\+Type.\+parse(req)}\label{md_sfcode_node_modules_content_type_README_autotoc_md6517}

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

\end{DoxyCode}


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

Throws a {\ttfamily Type\+Error} if the {\ttfamily Content-\/\+Type} header is missing or invalid.\hypertarget{md_sfcode_node_modules_content_type_README_autotoc_md6518}{}\doxysubsection{content\+Type.\+parse(res)}\label{md_sfcode_node_modules_content_type_README_autotoc_md6518}

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

\end{DoxyCode}


Parse the {\ttfamily content-\/type} header set on the given {\ttfamily res}. Short-\/cut for `content\+Type.\+parse(res.\+get\+Header(\textquotesingle{}content-\/type'))\`{}.

Throws a {\ttfamily Type\+Error} if the {\ttfamily Content-\/\+Type} header is missing or invalid.\hypertarget{md_sfcode_node_modules_content_type_README_autotoc_md6519}{}\doxysubsection{content\+Type.\+format(obj)}\label{md_sfcode_node_modules_content_type_README_autotoc_md6519}

\begin{DoxyCode}{0}
\DoxyCodeLine{var str = contentType.format(\{type: 'image/svg+xml'\}) }

\end{DoxyCode}


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


\begin{DoxyItemize}
\item {\ttfamily type}\+: The media type (will be lower-\/cased). Example\+: `\textquotesingle{}image/svg+xml'\`{}
\item {\ttfamily parameters}\+: An object of the parameters in the media type (name of the parameter will be lower-\/cased). Example\+: `\{charset\+: \textquotesingle{}utf-\/8'\}\`{}
\end{DoxyItemize}

Throws a {\ttfamily Type\+Error} if the object contains an invalid type or parameter names.\hypertarget{md_sfcode_node_modules_content_type_README_autotoc_md6520}{}\doxysection{License}\label{md_sfcode_node_modules_content_type_README_autotoc_md6520}
\mbox{[}MIT\mbox{]}(LICENSE) 