# 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

Latest version **1.0.7** (published 2015-05-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install con-type
pnpm add con-type
yarn add con-type
bun add con-type
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2015-05-24 |
| First published | 2015-05-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.6 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Njoku Chukwudi Richard |
| Maintainers | ncrichards |
| Keywords | Content-type, mime-type, charset |

## Links

- npm: https://www.npmjs.com/package/con-type
- Repository: https://github.com/ncrichards/con-type
- Homepage: https://github.com/ncrichards/con-type#readme
- Issues: https://github.com/ncrichards/con-type/issues
- npm.io page: https://npm.io/package/con-type

## Recent versions

- 1.0.7 (latest) — 2015-05-24
- 1.0.6 — 2015-05-24
- 1.0.4 — 2015-05-24
- 1.0.3 — 2015-05-24
- 1.0.2 — 2015-05-24
- 1.0.1 — 2015-05-24
- 1.0.0 — 2015-05-24

## README

# 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

```sh
$ npm install con-type
```

## API

```js
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 ";;"
```js
var obj = contentType.parse('text/html;;charset=utf-8')
```
Two objects will always be returned 
the above example will output 
```js
console.log(obj.type)
```
text/html
```js
console.log(obj.charset)
```
utf-8

in the case where the charset is not available, the output will be a null
Example:
```js
var obj = contentType.parse('text/html;;')
```
```js
console.log(obj.charset)
```
Will output null


## License

[MIT](LICENSE)

---
_Source: https://npm.io/package/con-type · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
