{"_id":"content-type@3.1.0","bugs":{"url":"https://github.com/jshttp/content-type/issues"},"dist":{"shasum":"69d1afda3d440fcdae49713eaa3bdad8df9a1aab","tarball":"http://registry-npm.ywwl.com/content-type/download/content-type-3.1.0.tgz","integrity":"sha512-z26wZR7iXahgpSK7XgnB4IbRVmUNSODvsX9qC9TAru7AcWGiqn5YKy+OH3PLRrwyAnewykKhCqnD+VV3a8uT8Q==","fileCount":6,"unpackedSize":35933,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/content-type@3.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD+kaPHFc03MQJdSyO1DAaSL9gxi0Ris8zq8pAeINJbtQIgKqwh0ypX2VZ+/p6bIwZj8FQwcaH09CRiFpgtq7NM1Wg="}],"size":8184,"noattachment":false,"key":"/content-type/-/content-type-3.1.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":"04f6177935533a4b7cd44c92c7fbfbe31446e815","license":"MIT","scripts":{"size":"size-limit","test":"ts-scripts test && npm run size","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.1.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"},"size-limit":[{"path":"dist/index.js","limit":"1.15 kB"}],"ts-scripts":{"dist":["dist"],"project":["tsconfig.build.json"]},"_npmVersion":"11.19.1","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.8.2","devDependencies":{"vitest":"^4.1.11","size-limit":"^13.0.3","typescript":"^7.0.2","@vitest/coverage-v8":"^4.1.11","@borderless/ts-scripts":"^0.15.0","@size-limit/preset-small-lib":"^13.0.3"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/content-type_3.1.0_1789081826187_0.7684574628453875"},"_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 (always lower case). 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- `index`: The index where parsing stopped. Example: `33`.\n\nThe parser is lenient and does not validate or throw on malformed input.\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### Validation\n\nThis package exposes the validation functions used by `format`:\n\n- `isTypeValid` Validates the MIME type against RFC 9110.\n- `isTokenValid` Validates a token against RFC 9110 (used for the parameter name).\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":1789081826268,"_cnpm_publish_time":1789081826268,"dist-tags":{"latest":"3.1.1"}}