{"name":"fast-content-type-parse","version":"3.0.0","keywords":["content-type","rfc7231"],"author":{"name":"Aras Abbasi","email":"aras.abbasi@gmail.com"},"license":"MIT","_id":"fast-content-type-parse@3.0.0","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":"metcoder95","email":"me@metcoder.dev"},{"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":"5590b6c807cc598be125e6740a9fde589d2b7afb","tarball":"http://registry-npm.ywwl.com/fast-content-type-parse/download/fast-content-type-parse-3.0.0.tgz","fileCount":20,"integrity":"sha512-ZvLdcY8P+N8mGQJahJV5G4U88CSvT1rP8ApL6uETe88MBXrBHAkZlSEySdUlyztF7ccb+Znos3TFqaepHxdhBg==","signatures":[{"sig":"MEUCIFn2Esbn8+1lJP68G6d4pZ+HI0HmPrIw8aXchKJ4TZcpAiEAnFR3V7txi88ulGA1yeNNslIbEOt2uibNvxlJVoib1vc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22925,"size":6363,"noattachment":false,"key":"/fast-content-type-parse/-/fast-content-type-parse-3.0.0.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":"bf6861c1a2bad438f9a1f274477096aff04a09fd","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":"c8 --100 node --test","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":{"c8":"^10.1.3","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_3.0.0_1741451583605_0.14521008573288618","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":1741451583786,"_cnpm_publish_time":1741451583786,"dist-tags":{"latest":"4.0.1"}}