{"name":"content-type","version":"2.1.0","keywords":["content-type","http","req","res","rfc7231","rfc9110"],"author":{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"},"license":"MIT","_id":"content-type@2.1.0","maintainers":[{"name":"ulisesgascon","email":"ulisesgascondev@gmail.com"},{"name":"blakeembrey","email":"hello@blakeembrey.com"},{"name":"dougwilson","email":"doug@somethingdoug.com"}],"homepage":"https://github.com/jshttp/content-type#readme","bugs":{"url":"https://github.com/jshttp/content-type/issues"},"dist":{"shasum":"d9389c43c0a8cf6a355db464d21e07092a40493a","tarball":"http://registry-npm.ywwl.com/content-type/download/content-type-2.1.0.tgz","fileCount":6,"integrity":"sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==","signatures":[{"sig":"MEQCIAesCKlTxK7DDJj+bRVxVqnPebCrDYKlCvXYXzC13PTbAiBzuJ2rrSEvAQKMfpV7FwOMi8eKomTRHVf5/y9ZnGl8sQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIDm2i9kdHCg3OWR9UNJs52nxr+qrdnmtp6Rhk0R0mi4EAiBtS5WDVW31UZOXRRfjO4UPpP3sfCJHmwURZckhcnrAyg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23136,"size":6227,"noattachment":false,"key":"/content-type/-/content-type-2.1.0.tgz"},"main":"./dist/index.js","type":"commonjs","engines":{"node":">=18"},"exports":"./dist/index.js","funding":{"url":"https://opencollective.com/express","type":"opencollective"},"gitHead":"8c2fedda8b40bd519c3ca49cc2a80aebaa1446e3","scripts":{"test":"ts-scripts test","bench":"vitest bench","build":"ts-scripts build","specs":"ts-scripts specs","format":"ts-scripts format","prepare":"ts-scripts install && npm run build"},"typings":"./dist/index.d.ts","_npmUser":{"name":"blakeembrey","email":"hello@blakeembrey.com"},"repository":{"url":"git+https://github.com/jshttp/content-type.git","type":"git"},"ts-scripts":{"dist":["dist"],"project":["tsconfig.build.json"]},"_npmVersion":"11.17.0","description":"Create and parse HTTP Content-Type header","directories":{},"_nodeVersion":"26.5.1","_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.2.4","typescript":"^5.7.3","@vitest/coverage-v8":"^3.0.5","@borderless/ts-scripts":"^0.15.0"},"_npmOperationalInternal":{"tmp":"tmp/content-type_2.1.0_1786653178120_0.717641487797847","host":"s3://npm-registry-packages-npm-production"},"readme":"# content-type\n\n[![NPM version][npm-image]][npm-url]\n[![NPM downloads][downloads-image]][downloads-url]\n[![Build status][build-image]][build-url]\n[![Build coverage][coverage-image]][coverage-url]\n[![License][license-image]][license-url]\n\nCreate and parse HTTP `Content-Type` header.\n\n## Installation\n\n```sh\nnpm install content-type\n```\n\n## API\n\n```js\nimport * as contentType from \"content-type\";\n```\n\n### contentType.parse(string, options?)\n\n```js\nconst obj = contentType.parse(\"image/svg+xml; charset=utf-8\");\n```\n\nParse a `Content-Type` header. This will return an object with the following properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`):\n\n- `type`: The media type. Example: `'image/svg+xml'`.\n- `parameters`: An object of the parameters in the media type (parameter name is always lower case). Example: `{charset: 'utf-8'}`.\n\nThe parser is lenient and does not error. You should validate `type` and `parameters` before trusting them.\n\n#### Options\n\n- `parameters` (default: `true`): Set to `false` to skip parameters.\n- `comma` (default: `false`): Set to `true` to stop on a comma. This can be used to parse the media range in an `Accept` header.\n- `start` (default: `0`): Set index to start parsing from.\n\n### contentType.format(obj)\n\n```js\nconst str = contentType.format({\n  type: \"image/svg+xml\",\n  parameters: { charset: \"utf-8\" },\n});\n```\n\nFormat an object into a `Content-Type` header. This will return a string of the content type for the given object with the following properties (examples are shown that produce the string `'image/svg+xml; charset=utf-8'`):\n\n- `type`: The media type. Example: `'image/svg+xml'`.\n- `parameters`: An optional object of the parameters in the media type. Example: `{charset: 'utf-8'}`.\n\nThrows a `TypeError` if the object contains an invalid type or parameter names.\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/content-type\n[npm-url]: https://npmjs.org/package/content-type\n[downloads-image]: https://img.shields.io/npm/dm/content-type\n[downloads-url]: https://npmjs.org/package/content-type\n[build-image]: https://img.shields.io/github/actions/workflow/status/jshttp/content-type/ci.yml?branch=master\n[build-url]: https://github.com/jshttp/content-type/actions/workflows/ci.yml?query=branch%3Amaster\n[coverage-image]: https://img.shields.io/codecov/c/gh/jshttp/content-type\n[coverage-url]: https://codecov.io/gh/jshttp/content-type\n[license-image]: http://img.shields.io/npm/l/content-type.svg?style=flat\n[license-url]: LICENSE\n","publish_time":1786653178206,"_cnpm_publish_time":1786653178206,"dist-tags":{"latest":"3.1.1"}}