{
  "_id": "@tinyhttp/content-type",
  "maintainers": [
    {
      "email": "hi@v1rtl.site",
      "name": "dropthebeatbro"
    },
    {
      "email": "npmjs.uyolv@fastmail.com",
      "name": "v1rtl"
    }
  ],
  "dist-tags": {
    "latest": "0.1.4"
  },
  "author": {
    "name": "v1rtl",
    "email": "hi@v1rtl.site"
  },
  "_rev": "5-4534fa52c734b23429b4c5bddb10f004",
  "description": "content-type rewrite in TypeScript and ESM",
  "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\n",
  "repository": {
    "url": "git+https://github.com/tinyhttp/content-type.git",
    "type": "git"
  },
  "bugs": {
    "url": "https://github.com/tinyhttp/content-type/issues"
  },
  "license": "MIT",
  "versions": {
    "0.1.1": {
      "name": "@tinyhttp/content-type",
      "version": "0.1.1",
      "author": {
        "name": "v1rtl",
        "email": "hi@v1rtl.site"
      },
      "license": "MIT",
      "_id": "@tinyhttp/content-type@0.1.1",
      "maintainers": [
        {
          "name": "dropthebeatbro",
          "email": "hi@v1rtl.site"
        }
      ],
      "homepage": "https://github.com/tinyhttp/content-type#readme",
      "bugs": {
        "url": "https://github.com/tinyhttp/content-type/issues"
      },
      "dist": {
        "shasum": "c3cf3cb188887c266fd1cdc58d5c8e0158987e71",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/@tinyhttp/content-type/-/content-type-0.1.1.tgz",
        "fileCount": 5,
        "integrity": "sha512-OFeWKIb4vx7LN0K+3Yp1cETm23IIEUljR0KxPbhjG//fYVFXbp9x55+LbkA1P8TnLhAbITTiiN/tothCAY3tjw==",
        "signatures": [
          {
            "sig": "MEUCIF2k/MIH2HurSNOSzsgiCjDZethOFfzMmnRvsQTQJUPeAiEAuR3SdAc/p9rPLOfLjKXP53nOdASpiiW7iCATTkDqEKg=",
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
          }
        ],
        "unpackedSize": 7452
      },
      "type": "module",
      "_from": "file:tinyhttp-content-type-0.1.1.tgz",
      "types": "./dist/index.d.ts",
      "engines": {
        "node": ">=12.x"
      },
      "exports": "./dist/index.js",
      "scripts": {
        "build": "tsup src/index.ts --format esm --dts"
      },
      "_npmUser": {
        "name": "dropthebeatbro",
        "email": "hi@v1rtl.site"
      },
      "_resolved": "/tmp/7774a38f6d5a41a90ff4e5cdeac924c3/tinyhttp-content-type-0.1.1.tgz",
      "_integrity": "sha512-OFeWKIb4vx7LN0K+3Yp1cETm23IIEUljR0KxPbhjG//fYVFXbp9x55+LbkA1P8TnLhAbITTiiN/tothCAY3tjw==",
      "repository": {
        "url": "git+https://github.com/tinyhttp/content-type.git",
        "type": "git"
      },
      "_npmVersion": "10.1.0",
      "description": "content-type rewrite in TypeScript and ESM",
      "directories": {},
      "_nodeVersion": "20.7.0",
      "_hasShrinkwrap": false,
      "devDependencies": {
        "tsup": "^7.2.0",
        "typescript": "^5.2.2",
        "@types/node": "^20.6.4"
      },
      "_npmOperationalInternal": {
        "tmp": "tmp/content-type_0.1.1_1695568044437_0.6559559461140183",
        "host": "s3://npm-registry-packages"
      }
    },
    "0.1.2": {
      "name": "@tinyhttp/content-type",
      "version": "0.1.2",
      "author": {
        "name": "v1rtl",
        "email": "hi@v1rtl.site"
      },
      "license": "MIT",
      "_id": "@tinyhttp/content-type@0.1.2",
      "maintainers": [
        {
          "name": "dropthebeatbro",
          "email": "hi@v1rtl.site"
        }
      ],
      "homepage": "https://github.com/tinyhttp/content-type#readme",
      "bugs": {
        "url": "https://github.com/tinyhttp/content-type/issues"
      },
      "dist": {
        "shasum": "6cde09a26801d819ab7225a5cd55afe48c51aa9f",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/@tinyhttp/content-type/-/content-type-0.1.2.tgz",
        "fileCount": 5,
        "integrity": "sha512-acPZ+sDXm41kvkQUJV++UeceydIvBHXQJcOjxIXdcGCkLI9IIjpDW0oBlJOonrW473QurA4aNwHLtMQSnvwNcQ==",
        "signatures": [
          {
            "sig": "MEYCIQCEsuJYI/cvJ5SO1xd4g3RQq26O7QaxCsRD6CN/MUmJRwIhAPt0lwZjTq0StBnp1r2qIJ/2LhceIGLrSnphVUHBpz9t",
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
          }
        ],
        "unpackedSize": 7625
      },
      "type": "module",
      "_from": "file:tinyhttp-content-type-0.1.2.tgz",
      "types": "./dist/index.d.ts",
      "engines": {
        "node": ">=12.x"
      },
      "exports": "./dist/index.js",
      "scripts": {
        "build": "tsup src/index.ts --format esm --dts"
      },
      "_npmUser": {
        "name": "dropthebeatbro",
        "email": "hi@v1rtl.site"
      },
      "_resolved": "/tmp/2df01efaca043e87e6b0688bf4160107/tinyhttp-content-type-0.1.2.tgz",
      "_integrity": "sha512-acPZ+sDXm41kvkQUJV++UeceydIvBHXQJcOjxIXdcGCkLI9IIjpDW0oBlJOonrW473QurA4aNwHLtMQSnvwNcQ==",
      "repository": {
        "url": "git+https://github.com/tinyhttp/content-type.git",
        "type": "git"
      },
      "_npmVersion": "10.1.0",
      "description": "content-type rewrite in TypeScript and ESM",
      "directories": {},
      "_nodeVersion": "20.7.0",
      "dependencies": {
        "uvu": "^0.5.6"
      },
      "_hasShrinkwrap": false,
      "devDependencies": {
        "tsm": "^2.3.0",
        "tsup": "^7.2.0",
        "eslint": "^8.50.0",
        "typescript": "^5.2.2",
        "@types/node": "^20.6.4",
        "@typescript-eslint/parser": "^6.7.2",
        "@typescript-eslint/eslint-plugin": "^6.7.2"
      },
      "_npmOperationalInternal": {
        "tmp": "tmp/content-type_0.1.2_1695569247257_0.9652026894397967",
        "host": "s3://npm-registry-packages"
      }
    },
    "0.1.3": {
      "name": "@tinyhttp/content-type",
      "version": "0.1.3",
      "author": {
        "name": "v1rtl",
        "email": "hi@v1rtl.site"
      },
      "license": "MIT",
      "_id": "@tinyhttp/content-type@0.1.3",
      "maintainers": [
        {
          "name": "dropthebeatbro",
          "email": "hi@v1rtl.site"
        }
      ],
      "homepage": "https://github.com/tinyhttp/content-type#readme",
      "bugs": {
        "url": "https://github.com/tinyhttp/content-type/issues"
      },
      "dist": {
        "shasum": "94e0b0c83534f9cb964625cfdb6844476dd257e9",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/@tinyhttp/content-type/-/content-type-0.1.3.tgz",
        "fileCount": 5,
        "integrity": "sha512-od4LeIco+UjGzBoGoJDpU+cvA1yeJU2YNtY+6TuupDnF4Z4haCNXe4iiGAbOAs1ahNvh/HVqMxA8/aVVHZyPFw==",
        "signatures": [
          {
            "sig": "MEUCIQCOoDIg0muQPmbfRnUbS/MrLcPiiXAa6Dm04LG6L78DbAIgeJDxClXwwKu12L4+e6vo0bfm88vEid1mH5txvlzpKEY=",
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
          }
        ],
        "unpackedSize": 8479
      },
      "type": "module",
      "_from": "file:tinyhttp-content-type-0.1.3.tgz",
      "types": "./dist/index.d.ts",
      "engines": {
        "node": ">=12.4"
      },
      "exports": "./dist/index.js",
      "scripts": {
        "test": "uvu -r tsm test",
        "build": "tsup src/index.ts --format esm --dts",
        "test:report": "c8 report --reporter=text-lcov > coverage.lcov",
        "test:coverage": "c8 --include=src pnpm test"
      },
      "_npmUser": {
        "name": "dropthebeatbro",
        "email": "hi@v1rtl.site"
      },
      "_resolved": "/tmp/9c34b0b4e22820b0a234bdb35f91d550/tinyhttp-content-type-0.1.3.tgz",
      "_integrity": "sha512-od4LeIco+UjGzBoGoJDpU+cvA1yeJU2YNtY+6TuupDnF4Z4haCNXe4iiGAbOAs1ahNvh/HVqMxA8/aVVHZyPFw==",
      "repository": {
        "url": "git+https://github.com/tinyhttp/content-type.git",
        "type": "git"
      },
      "_npmVersion": "10.1.0",
      "description": "content-type rewrite in TypeScript and ESM",
      "directories": {},
      "_nodeVersion": "20.7.0",
      "dependencies": {
        "uvu": "^0.5.6"
      },
      "publishConfig": {
        "access": "public"
      },
      "_hasShrinkwrap": false,
      "devDependencies": {
        "c8": "^8.0.1",
        "tsm": "^2.3.0",
        "tsup": "^7.2.0",
        "eslint": "^8.50.0",
        "typescript": "^5.2.2",
        "@types/node": "^20.6.4",
        "@typescript-eslint/parser": "^6.7.2",
        "@typescript-eslint/eslint-plugin": "^6.7.2"
      },
      "_npmOperationalInternal": {
        "tmp": "tmp/content-type_0.1.3_1695570359082_0.760405084724256",
        "host": "s3://npm-registry-packages"
      }
    },
    "0.1.4": {
      "name": "@tinyhttp/content-type",
      "version": "0.1.4",
      "author": {
        "name": "v1rtl",
        "email": "hi@v1rtl.site"
      },
      "license": "MIT",
      "_id": "@tinyhttp/content-type@0.1.4",
      "maintainers": [
        {
          "name": "dropthebeatbro",
          "email": "hi@v1rtl.site"
        }
      ],
      "homepage": "https://github.com/tinyhttp/content-type#readme",
      "bugs": {
        "url": "https://github.com/tinyhttp/content-type/issues"
      },
      "dist": {
        "shasum": "112bce3b564213e0ed43fa76fccca4237be3a634",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/@tinyhttp/content-type/-/content-type-0.1.4.tgz",
        "fileCount": 5,
        "integrity": "sha512-dl6f3SHIJPYbhsW1oXdrqOmLSQF/Ctlv3JnNfXAE22kIP7FosqJHxkz/qj2gv465prG8ODKH5KEyhBkvwrueKQ==",
        "signatures": [
          {
            "sig": "MEUCIDRu1e2BMkAxH3iputwBE5iVpDR88ev8iMYozGreUyH2AiEAr2iKaXbLhD3eVVwnZ++cRt1kOuH6HjmBhDzGaub5OT8=",
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
          }
        ],
        "unpackedSize": 8455
      },
      "type": "module",
      "_from": "file:tinyhttp-content-type-0.1.4.tgz",
      "types": "./dist/index.d.ts",
      "engines": {
        "node": ">=12.4"
      },
      "exports": "./dist/index.js",
      "scripts": {
        "test": "uvu -r tsm test",
        "build": "tsup src/index.ts --format esm --dts",
        "test:report": "c8 report --reporter=text-lcov > coverage.lcov",
        "test:coverage": "c8 --include=src pnpm test"
      },
      "_npmUser": {
        "name": "dropthebeatbro",
        "email": "hi@v1rtl.site"
      },
      "_resolved": "/tmp/54b5aefae068f5b252e6750387832e1e/tinyhttp-content-type-0.1.4.tgz",
      "_integrity": "sha512-dl6f3SHIJPYbhsW1oXdrqOmLSQF/Ctlv3JnNfXAE22kIP7FosqJHxkz/qj2gv465prG8ODKH5KEyhBkvwrueKQ==",
      "repository": {
        "url": "git+https://github.com/tinyhttp/content-type.git",
        "type": "git"
      },
      "_npmVersion": "10.1.0",
      "description": "content-type rewrite in TypeScript and ESM",
      "directories": {},
      "_nodeVersion": "20.7.0",
      "publishConfig": {
        "access": "public"
      },
      "_hasShrinkwrap": false,
      "devDependencies": {
        "c8": "^8.0.1",
        "tsm": "^2.3.0",
        "uvu": "^0.5.6",
        "tsup": "^7.2.0",
        "eslint": "^8.50.0",
        "typescript": "^5.2.2",
        "@types/node": "^20.6.4",
        "@typescript-eslint/parser": "^6.7.2",
        "@typescript-eslint/eslint-plugin": "^6.7.2"
      },
      "_npmOperationalInternal": {
        "tmp": "tmp/content-type_0.1.4_1695918982722_0.646844626210682",
        "host": "s3://npm-registry-packages"
      }
    }
  },
  "name": "@tinyhttp/content-type",
  "time": {
    "created": "2023-09-24T15:07:23.738Z",
    "modified": "2026-05-23T14:28:55.924Z",
    "0.1.1": "2023-09-24T15:07:24.625Z",
    "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"
  },
  "readmeFilename": "README.md",
  "homepage": "https://github.com/tinyhttp/content-type#readme"
}