This JavaScript/Node.js library helps you create, parse, and format HTTP Content-Type headers. It provides functions to parse a Content-Type string into a media type and parameters, and to format an object back into a header value, which is useful when handling HTTP requests and responses.
Project status
- Actively maintained, the repo shows recent activity (last upstream push 2026-06-01) and a major update was published in 2026 (v2.0.0 on 2026-05-11).
- Apparent update cadence is irregular, with long gaps between updates (v1.0.4 in 2017, v1.0.5 in 2023, then v2.0.0 in 2026), followed by continued recent activity.
AI summary generated Today
Recent updates
v2.0.0
3 weeks agov2.0.0 is a major rewrite of the library (ported to TypeScript) focused on performance (reported as about 3x faster) and on making `parse` lenient. The documented behavior change is that `parse` no longer throws on invalid input, and a new `options.parameters` flag allows skipping parameter parsing.
Featuresv1.0.5
1/29/2023Release 1.0.5 primarily targets performance in the `contentType.parse` implementation by avoiding unnecessary value escaping work when parsing quoted parameters. The code diff also includes substantial development and CI tooling updates (ESLint, test coverage tooling, GitHub Actions vs Travis), though those are not mentioned in the release notes.
v1.0.4
9/11/2017Release v1.0.4 makes a targeted performance change to the Content-Type parsing logic. Specifically, it avoids running the parameter parsing regular expression when the header contains no parameters.
v1.0.3
9/11/2017v1.0.3 is a small refactor release focused on performance, specifically removing argument reassignment. The main production code changes are in parsing/formatting internals of the HTTP Content-Type header.
v1.0.2
5/10/2016Release 1.0.2 is described as a performance improvement by enabling JavaScript strict mode. The runtime code change is minimal, adding 'use strict' to index.js.
v1.0.1
2/14/2015Release v1.0.1 primarily improves the error message thrown when `contentType.parse` is given req/res-like objects missing a `Content-Type` header. The code change specifically adjusts the validation path for object inputs and the related unit test expectations.
v1.0.0
2/2/2015Release 1.0.0 is an initial implementation, derived from media-typer@0.3.0. No additional features, fixes, security updates, or migration guidance are described in the release notes.