{"name":"content-type","version":"2.0.0","keywords":["content-type","http","req","res","rfc7231","rfc9110"],"author":{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"},"license":"MIT","_id":"content-type@2.0.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":"2fb3ede69dffa0af78ca7c4ce7589680638b56df","tarball":"http://registry-npm.ywwl.com/content-type/download/content-type-2.0.0.tgz","fileCount":6,"integrity":"sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==","signatures":[{"sig":"MEUCIQDo/pgl1B1Nh7gcPd6UZuC4ZbXRQbyK9yyb/vbs0gfXawIgbAZqvZUEIG4Gg+scaeGVJziTkb9NRH0nnbYRAHh1VUE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20751,"size":5728,"noattachment":false,"key":"/content-type/-/content-type-2.0.0.tgz"},"main":"./dist/index.js","type":"commonjs","engines":{"node":">=18"},"exports":"./dist/index.js","funding":{"url":"https://opencollective.com/express","type":"opencollective"},"gitHead":"7e7a40b5a8725118c04289541d5ecb074c0c51ea","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.13.0","description":"Create and parse HTTP Content-Type header","directories":{},"_nodeVersion":"26.1.0","_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.0.0_1778520128650_0.2234915362065566","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":1778520128801,"_cnpm_publish_time":1778520128801,"dist-tags":{"latest":"3.1.1"}}