{"versions":{"0.1.1":{"name":"@tinyhttp/content-type","description":"content-type rewrite in TypeScript and ESM","version":"0.1.1","repository":{"type":"git","url":"git+https://github.com/tinyhttp/content-type.git"},"engines":{"node":">=12.x"},"author":{"name":"v1rtl","email":"hi@v1rtl.site"},"license":"MIT","type":"module","types":"./dist/index.d.ts","exports":"./dist/index.js","devDependencies":{"@types/node":"^20.6.4","tsup":"^7.2.0","typescript":"^5.2.2"},"scripts":{"build":"tsup src/index.ts --format esm --dts"},"bugs":{"url":"https://github.com/tinyhttp/content-type/issues"},"homepage":"https://github.com/tinyhttp/content-type#readme","_id":"@tinyhttp/content-type@0.1.1","_integrity":"sha512-OFeWKIb4vx7LN0K+3Yp1cETm23IIEUljR0KxPbhjG//fYVFXbp9x55+LbkA1P8TnLhAbITTiiN/tothCAY3tjw==","_resolved":"/tmp/7774a38f6d5a41a90ff4e5cdeac924c3/tinyhttp-content-type-0.1.1.tgz","_from":"file:tinyhttp-content-type-0.1.1.tgz","_nodeVersion":"20.7.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-OFeWKIb4vx7LN0K+3Yp1cETm23IIEUljR0KxPbhjG//fYVFXbp9x55+LbkA1P8TnLhAbITTiiN/tothCAY3tjw==","shasum":"c3cf3cb188887c266fd1cdc58d5c8e0158987e71","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@tinyhttp/content-type/-/content-type-0.1.1.tgz","fileCount":5,"unpackedSize":7452,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF2k/MIH2HurSNOSzsgiCjDZethOFfzMmnRvsQTQJUPeAiEAuR3SdAc/p9rPLOfLjKXP53nOdASpiiW7iCATTkDqEKg="}]},"_npmUser":{"name":"anonymous","email":"hi@v1rtl.site"},"directories":{},"maintainers":[{"name":"anonymous","email":"hi@v1rtl.site"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/content-type_0.1.1_1695568044437_0.6559559461140183"},"_hasShrinkwrap":false,"contributors":[]},"0.1.2":{"name":"@tinyhttp/content-type","description":"content-type rewrite in TypeScript and ESM","version":"0.1.2","repository":{"type":"git","url":"git+https://github.com/tinyhttp/content-type.git"},"engines":{"node":">=12.x"},"author":{"name":"v1rtl","email":"hi@v1rtl.site"},"license":"MIT","type":"module","types":"./dist/index.d.ts","exports":"./dist/index.js","devDependencies":{"@types/node":"^20.6.4","@typescript-eslint/eslint-plugin":"^6.7.2","@typescript-eslint/parser":"^6.7.2","eslint":"^8.50.0","tsm":"^2.3.0","tsup":"^7.2.0","typescript":"^5.2.2"},"dependencies":{"uvu":"^0.5.6"},"scripts":{"build":"tsup src/index.ts --format esm --dts"},"bugs":{"url":"https://github.com/tinyhttp/content-type/issues"},"homepage":"https://github.com/tinyhttp/content-type#readme","_id":"@tinyhttp/content-type@0.1.2","_integrity":"sha512-acPZ+sDXm41kvkQUJV++UeceydIvBHXQJcOjxIXdcGCkLI9IIjpDW0oBlJOonrW473QurA4aNwHLtMQSnvwNcQ==","_resolved":"/tmp/2df01efaca043e87e6b0688bf4160107/tinyhttp-content-type-0.1.2.tgz","_from":"file:tinyhttp-content-type-0.1.2.tgz","_nodeVersion":"20.7.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-acPZ+sDXm41kvkQUJV++UeceydIvBHXQJcOjxIXdcGCkLI9IIjpDW0oBlJOonrW473QurA4aNwHLtMQSnvwNcQ==","shasum":"6cde09a26801d819ab7225a5cd55afe48c51aa9f","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@tinyhttp/content-type/-/content-type-0.1.2.tgz","fileCount":5,"unpackedSize":7625,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCEsuJYI/cvJ5SO1xd4g3RQq26O7QaxCsRD6CN/MUmJRwIhAPt0lwZjTq0StBnp1r2qIJ/2LhceIGLrSnphVUHBpz9t"}]},"_npmUser":{"name":"anonymous","email":"hi@v1rtl.site"},"directories":{},"maintainers":[{"name":"anonymous","email":"hi@v1rtl.site"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/content-type_0.1.2_1695569247257_0.9652026894397967"},"_hasShrinkwrap":false,"contributors":[]},"0.1.3":{"name":"@tinyhttp/content-type","description":"content-type rewrite in TypeScript and ESM","version":"0.1.3","repository":{"type":"git","url":"git+https://github.com/tinyhttp/content-type.git"},"engines":{"node":">=12.4"},"author":{"name":"v1rtl","email":"hi@v1rtl.site"},"license":"MIT","type":"module","types":"./dist/index.d.ts","exports":"./dist/index.js","devDependencies":{"@types/node":"^20.6.4","@typescript-eslint/eslint-plugin":"^6.7.2","@typescript-eslint/parser":"^6.7.2","c8":"^8.0.1","eslint":"^8.50.0","tsm":"^2.3.0","tsup":"^7.2.0","typescript":"^5.2.2"},"dependencies":{"uvu":"^0.5.6"},"publishConfig":{"access":"public"},"scripts":{"build":"tsup src/index.ts --format esm --dts","test":"uvu -r tsm test","test:coverage":"c8 --include=src pnpm test","test:report":"c8 report --reporter=text-lcov > coverage.lcov"},"bugs":{"url":"https://github.com/tinyhttp/content-type/issues"},"homepage":"https://github.com/tinyhttp/content-type#readme","_id":"@tinyhttp/content-type@0.1.3","_integrity":"sha512-od4LeIco+UjGzBoGoJDpU+cvA1yeJU2YNtY+6TuupDnF4Z4haCNXe4iiGAbOAs1ahNvh/HVqMxA8/aVVHZyPFw==","_resolved":"/tmp/9c34b0b4e22820b0a234bdb35f91d550/tinyhttp-content-type-0.1.3.tgz","_from":"file:tinyhttp-content-type-0.1.3.tgz","_nodeVersion":"20.7.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-od4LeIco+UjGzBoGoJDpU+cvA1yeJU2YNtY+6TuupDnF4Z4haCNXe4iiGAbOAs1ahNvh/HVqMxA8/aVVHZyPFw==","shasum":"94e0b0c83534f9cb964625cfdb6844476dd257e9","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@tinyhttp/content-type/-/content-type-0.1.3.tgz","fileCount":5,"unpackedSize":8479,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCOoDIg0muQPmbfRnUbS/MrLcPiiXAa6Dm04LG6L78DbAIgeJDxClXwwKu12L4+e6vo0bfm88vEid1mH5txvlzpKEY="}]},"_npmUser":{"name":"anonymous","email":"hi@v1rtl.site"},"directories":{},"maintainers":[{"name":"anonymous","email":"hi@v1rtl.site"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/content-type_0.1.3_1695570359082_0.760405084724256"},"_hasShrinkwrap":false,"contributors":[]},"0.1.4":{"name":"@tinyhttp/content-type","description":"content-type rewrite in TypeScript and ESM","version":"0.1.4","repository":{"type":"git","url":"git+https://github.com/tinyhttp/content-type.git"},"engines":{"node":">=12.4"},"author":{"name":"v1rtl","email":"hi@v1rtl.site"},"license":"MIT","type":"module","types":"./dist/index.d.ts","exports":"./dist/index.js","devDependencies":{"@types/node":"^20.6.4","@typescript-eslint/eslint-plugin":"^6.7.2","@typescript-eslint/parser":"^6.7.2","c8":"^8.0.1","eslint":"^8.50.0","tsm":"^2.3.0","tsup":"^7.2.0","typescript":"^5.2.2","uvu":"^0.5.6"},"publishConfig":{"access":"public"},"scripts":{"build":"tsup src/index.ts --format esm --dts","test":"uvu -r tsm test","test:coverage":"c8 --include=src pnpm test","test:report":"c8 report --reporter=text-lcov > coverage.lcov"},"bugs":{"url":"https://github.com/tinyhttp/content-type/issues"},"homepage":"https://github.com/tinyhttp/content-type#readme","_id":"@tinyhttp/content-type@0.1.4","_integrity":"sha512-dl6f3SHIJPYbhsW1oXdrqOmLSQF/Ctlv3JnNfXAE22kIP7FosqJHxkz/qj2gv465prG8ODKH5KEyhBkvwrueKQ==","_resolved":"/tmp/54b5aefae068f5b252e6750387832e1e/tinyhttp-content-type-0.1.4.tgz","_from":"file:tinyhttp-content-type-0.1.4.tgz","_nodeVersion":"20.7.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-dl6f3SHIJPYbhsW1oXdrqOmLSQF/Ctlv3JnNfXAE22kIP7FosqJHxkz/qj2gv465prG8ODKH5KEyhBkvwrueKQ==","shasum":"112bce3b564213e0ed43fa76fccca4237be3a634","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@tinyhttp/content-type/-/content-type-0.1.4.tgz","fileCount":5,"unpackedSize":8455,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDRu1e2BMkAxH3iputwBE5iVpDR88ev8iMYozGreUyH2AiEAr2iKaXbLhD3eVVwnZ++cRt1kOuH6HjmBhDzGaub5OT8="}]},"_npmUser":{"name":"anonymous","email":"hi@v1rtl.site"},"directories":{},"maintainers":[{"name":"anonymous","email":"hi@v1rtl.site"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/content-type_0.1.4_1695918982722_0.646844626210682"},"_hasShrinkwrap":false,"contributors":[]}},"dist-tags":{"latest":"0.1.4"},"name":"@tinyhttp/content-type","time":{"created":"2023-09-24T15:07:34.183Z","0.1.1":"2023-09-24T15:07:24.625Z","modified":"2026-01-22T20:00:24.315Z","0.1.2":"2023-09-24T15:27:27.532Z","0.1.3":"2023-09-24T15:45:59.293Z","0.1.4":"2023-09-28T16:36:22.952Z"},"readme":"# @tinyhttp/content-type\n\n[![Version][v-badge-url]][npm-url] [![Downloads][dl-badge-url]][npm-url] [![GitHub Workflow Status][gh-actions-img]][github-actions] [![Codecov][cov-badge-url]][cov-url]\n\n> [`content-type`](https://github.com/jshttp/content-type) rewrite in TypeScript and ESM.\n\nCreate and parse HTTP Content-Type header according to RFC 7231\n\n## Install\n\n```sh\npnpm i @tinyhttp/content-type\n```\n\n## API\n\n```ts\nimport { parse, format } from '@tinyhttp/content-type'\n```\n\n### `parse(string: string | Request | Response)`\n\n```ts\nconst obj = parse('image/svg+xml; charset=utf-8')\n```\n\nParse a `Content-Type` header. This will return an object with the following\nproperties (examples are shown for the string `'image/svg+xml; charset=utf-8'`):\n\n- `type`: The media type (the type and subtype, always lower case).\n  Example: `'image/svg+xml'`\n\n- `parameters`: An object of the parameters in the media type (name of parameter\n  always lower case). Example: `{charset: 'utf-8'}`\n\nThrows a `TypeError` if the string is missing or invalid.\n\n```ts\nconst obj = contentType.parse(req)\n```\n\nParse the `Content-Type` header from the given `req`. Short-cut for\n`contentType.parse(req.headers['content-type'])`.\n\nThrows a `TypeError` if the `Content-Type` header is missing or invalid.\n\n```js\nconst obj = contentType.parse(res)\n```\n\nParse the `Content-Type` header set on the given `res`. Short-cut for\n`contentType.parse(res.getHeader('content-type'))`.\n\nThrows a `TypeError` if the `Content-Type` header is missing or invalid.\n\n### `format(obj)`\n\n```ts\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\ncontent type for the given object with the following properties (examples are\nshown that produce the string `'image/svg+xml; charset=utf-8'`):\n\n- `type`: The media type (will be lower-cased). Example: `'image/svg+xml'`\n\n- `parameters`: An object of the parameters in the media type (name of the\n  parameter will be lower-cased). Example: `{charset: 'utf-8'}`\n\nThrows a `TypeError` if the object contains an invalid type or parameter names.\n\n[v-badge-url]: https://img.shields.io/npm/v/@tinyhttp/content-type.svg?style=for-the-badge&color=FF69B4&label=&logo=npm\n[npm-url]: https://www.npmjs.com/package/@tinyhttp/content-type\n[cov-badge-url]: https://img.shields.io/coveralls/github/tinyhttp/content-type?style=for-the-badge&color=FF69B4\n[cov-url]: https://coveralls.io/github/tinyhttp/@tinyhttp/content-type\n[dl-badge-url]: https://img.shields.io/npm/dt/@tinyhttp/content-type?style=for-the-badge&color=FF69B4\n[github-actions]: https://github.com/tinyhttp/content-type/actions\n[gh-actions-img]: https://img.shields.io/github/actions/workflow/status/tinyhttp/content-type/ci.yml?branch=master&style=for-the-badge&color=FF69B4&label=&logo=github","users":{}}