{"_id":"content-type@3.0.0","bugs":{"url":"https://github.com/jshttp/content-type/issues"},"dist":{"shasum":"c946981e09aba276f5f5b21223bd0c01fded9c15","tarball":"http://registry-npm.ywwl.com/content-type/download/content-type-3.0.0.tgz","integrity":"sha512-AIi5H6p0xk5uknXcN3/rmhP8jgp69OfSe/JuKiQAFprJ7UGw7mwj7m4XcmDzlrnJDG+cGpphAINGdU3g3g7kDw==","fileCount":6,"unpackedSize":23006,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/content-type@3.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICmcsgEpvn+ZATTjaXuR+TgH4Ll0MKqLzA8GHAfCXAoQAiB5Ip/UJdRRDRTwD07LyyACM+CCpY6IALgMbE+KWuFFVg=="}],"size":6140,"noattachment":false,"key":"/content-type/-/content-type-3.0.0.tgz"},"main":"./dist/index.js","name":"content-type","type":"module","author":{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"},"engines":{"node":">=22"},"exports":"./dist/index.js","funding":{"url":"https://opencollective.com/express","type":"opencollective"},"gitHead":"04b9688ca0f574603e11e81ac4d7fc2fbf9008de","license":"MIT","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","version":"3.0.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:7bdcc576-a33f-4d3b-a990-9c30738fc4c6"},"approver":{"name":"blakeembrey","email":"hello@blakeembrey.com"}},"homepage":"https://github.com/jshttp/content-type#readme","keywords":["content-type","http","req","res","rfc7231","rfc9110"],"repository":{"url":"git+https://github.com/jshttp/content-type.git","type":"git"},"ts-scripts":{"dist":["dist"],"project":["tsconfig.build.json"]},"_npmVersion":"11.19.0","description":"Create and parse HTTP Content-Type header","directories":{},"maintainers":[{"name":"ulisesgascon","email":"ulisesgascondev@gmail.com"},{"name":"blakeembrey","email":"hello@blakeembrey.com"},{"name":"dougwilson","email":"doug@somethingdoug.com"}],"_nodeVersion":"26.7.0","devDependencies":{"vitest":"^4.1.11","typescript":"^7.0.2","@vitest/coverage-v8":"^4.1.11","@borderless/ts-scripts":"^0.15.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/content-type_3.0.0_1787266886061_0.026727981863394534"},"_hasShrinkwrap":false,"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":1787266886175,"_cnpm_publish_time":1787266886175,"dist-tags":{"latest":"3.1.1"}}