{"name":"fast-content-type-parse","version":"2.0.1","keywords":["content-type","rfc7231"],"author":{"name":"Aras Abbasi","email":"aras.abbasi@gmail.com"},"license":"MIT","_id":"fast-content-type-parse@2.0.1","maintainers":[{"name":"zekth","email":"vince.legoff@gmail.com"},{"name":"eomm","email":"behemoth89@gmail.com"},{"name":"gurgunday","email":"hey@gurgun.day"},{"name":"ivan-tymoshenko","email":"ivan@tymoshenko.me"},{"name":"simoneb","email":"simone.busoli@gmail.com"},{"name":"climba03003","email":"kaka@kakawebsitedemo.com"},{"name":"jsumners","email":"james.sumners@gmail.com"},{"name":"fdawgs","email":"frazer.dev@icloud.com"},{"name":"matteo.collina","email":"hello@matteocollina.com"},{"name":"uzlopak","email":"aras.abbasi@googlemail.com"}],"contributors":[{"url":"https://heyhey.to/G","name":"Gürgün Dayıoğlu","email":"hey@gurgun.day"},{"name":"Manuel Spigolon","email":"behemoth89@gmail.com"},{"url":"https://james.sumners.info","name":"James Sumners"},{"url":"https://github.com/fdawgs","name":"Frazer Smith","email":"frazer.dev@icloud.com"}],"homepage":"https://github.com/fastify/fast-content-type-parse#readme","bugs":{"url":"https://github.com/fastify/fast-content-type-parse/issues"},"dist":{"shasum":"c236124534ee2cb427c8d8e5ba35a4856947847b","tarball":"http://registry-npm.ywwl.com/fast-content-type-parse/download/fast-content-type-parse-2.0.1.tgz","fileCount":20,"integrity":"sha512-nGqtvLrj5w0naR6tDPfB4cUmYCqouzyQiz6C5y/LtcDllJdrcc6WaWW6iXyIIOErTa/XRybj28aasdn4LkVk6Q==","signatures":[{"sig":"MEQCIFnEE5KAv6EjQ0/GtAVh2kNCpzE+Bq9NNHuxihm2w0b6AiAm8gnAdaFr5UwDfCf1JysORAgySq974EbOX14cZ6G0Ug==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":21964,"size":6343,"noattachment":false,"key":"/fast-content-type-parse/-/fast-content-type-parse-2.0.1.tgz"},"main":"index.js","type":"commonjs","types":"./types/index.d.ts","funding":[{"url":"https://github.com/sponsors/fastify","type":"github"},{"url":"https://opencollective.com/fastify","type":"opencollective"}],"gitHead":"9d91aebf7b4c3f45657af2e6b977eedaae89d389","scripts":{"lint":"eslint","test":"npm run test:unit && npm run test:typescript","lint:fix":"eslint --fix","benchmark":"node benchmarks/simple.js && node benchmarks/simple-ows.js && node benchmarks/with-param.js && node benchmarks/with-param-quoted.js","test:unit":"tap","test:typescript":"tsd"},"_npmUser":{"name":"fdawgs","email":"frazer.dev@icloud.com"},"pre-commit":["lint","test"],"repository":{"url":"git+https://github.com/fastify/fast-content-type-parse.git","type":"git"},"_npmVersion":"10.8.2","description":"Parse HTTP Content-Type header according to RFC 7231","directories":{},"_nodeVersion":"20.18.1","_hasShrinkwrap":false,"devDependencies":{"tap":"^19.2.5","tsd":"^0.31.0","busboy":"^1.6.0","eslint":"^9.17.0","benchmark":"^2.1.4","neostandard":"^0.12.0","content-type":"^1.0.4","@fastify/pre-commit":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/fast-content-type-parse_2.0.1_1735910121566_0.6979407062448275","host":"s3://npm-registry-packages-npm-production"},"readme":"# fast-content-type-parse\n\n<div align=\"center\">\n\n[![NPM version](https://img.shields.io/npm/v/fast-content-type-parse.svg?style=flat)](https://www.npmjs.com/package/fast-content-type-parse)\n[![NPM downloads](https://img.shields.io/npm/dm/fast-content-type-parse.svg?style=flat)](https://www.npmjs.com/package/fast-content-type-parse)\n[![CI](https://github.com/fastify/fast-content-type-parse/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/fastify/fast-content-type-parse/actions/workflows/ci.yml)\n[![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard)\n[![Security Responsible Disclosure](https://img.shields.io/badge/Security-Responsible%20Disclosure-yellow.svg)](https://github.com/fastify/.github/blob/main/SECURITY.md)\n\n</div>\n\nParse HTTP Content-Type header according to RFC 7231.\n\n## Installation\n\n```sh\n$ npm install fast-content-type-parse\n```\n\n## Usage\n\n```js\nconst fastContentTypeParse = require('fast-content-type-parse')\n```\n\n### fastContentTypeParse.parse(string)\n\n```js\nconst contentType = fastContentTypeParse.parse('application/json; charset=utf-8')\n```\n\nParse a `Content-Type` header. Throws a `TypeError` if the string is invalid.\n\nIt will return an object with the following properties (examples are shown for\nthe string `'application/json; charset=utf-8'`):\n\n - `type`: The media type (the type and subtype, always lowercase).\n   Example: `'application/json'`\n\n - `parameters`: An object of the parameters in the media type (name of parameter\n   always lowercase). Example: `{charset: 'utf-8'}`\n\n### fastContentTypeParse.safeParse(string)\n\n```js\nconst contentType = fastContentTypeParse.safeParse('application/json; charset=utf-8')\n```\n\nParse a `Content-Type` header. It will not throw an Error if the header is invalid.\n\nThis will return an object with the following\nproperties (examples are shown for the string `'application/json; charset=utf-8'`):\n\n - `type`: The media type (the type and subtype, always lowercase).\n   Example: `'application/json'`\n\n - `parameters`: An object of the parameters in the media type (name of parameter\n   always lowercase). Example: `{charset: 'utf-8'}`\n\nIn case the header is invalid, it will return an object\nwith an empty string `''` as type and an empty Object for `parameters`.\n\n## Benchmarks\n\n```sh\nnode benchmarks/index.js\nutil#MIMEType x 1,206,781 ops/sec ±0.22% (96 runs sampled)\nfast-content-type-parse#parse x 3,752,236 ops/sec ±0.42% (96 runs sampled)\nfast-content-type-parse#safeParse x 3,675,645 ops/sec ±1.09% (94 runs sampled)\ncontent-type#parse x 1,452,582 ops/sec ±0.37% (95 runs sampled)\nbusboy#parseContentType x 924,306 ops/sec ±0.43% (94 runs sampled)\nFastest is fast-content-type-parse#parse\n```\n\n## Credits\n\nBased on the npm package `content-type`.\n\n## License\n\nLicensed under [MIT](./LICENSE).\n","publish_time":1735910121735,"_cnpm_publish_time":1735910121735,"dist-tags":{"latest":"4.0.1"}}