con-type
Generate and parse HTTP Content-Type header according to RFC 7231. This module can parse invalid mime type without breaking. You can obtain mime type and charset if available
Installation
$ npm install con-type
API
var contentType =
contentType.parse(string )
Example of sites with invalid content-type: www.aol.com "text/html;;charset=utf-8". Note the double semicolon ";;"
var obj = contentType
Two objects will always be returned the above example will output
console
text/html
console
utf-8
in the case where the charset is not available, the output will be a null Example:
var obj = contentType
console
Will output null