1.0.7 • Published 9 years ago

con-type v1.0.7

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

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 = require('con-type')

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.parse('text/html;;charset=utf-8')

Two objects will always be returned the above example will output

console.log(obj.type)

text/html

console.log(obj.charset)

utf-8

in the case where the charset is not available, the output will be a null Example:

var obj = contentType.parse('text/html;;')
console.log(obj.charset)

Will output null

License

MIT

1.0.7

9 years ago

1.0.6

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago