Back to Explore

jshttp/content-type

GitHub
2 updates · last 90 days3 watchersOpen source

Last release:

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

  • Active maintenance appears likely, with upstream and repository activity as recent as 2026-08-24, and a v3.0.0 update on 2026-08-20.
  • The apparent update cadence is fairly recent, roughly weekly to biweekly within 2026-08 (v2.1.0 on 2026-08-13, then v3.0.0 on 2026-08-20).

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v3.0.0

    v3.0.0 is published as an ESM-only package. The documented intent is that the API surface (parse/format) remains the same, but the repository changes show broader packaging and runtime requirements changes.

    Breaking
  • v2.1.0

    v2.1.0 extends the parser to optionally stop parsing at the first comma (intended for `Accept` header media ranges). The code change also adds a new `index` field to the public `ContentType` type and introduces a new `start` option to begin parsing from an arbitrary offset.

    Features
  • v2.0.0

    v2.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.

    Features
  • v1.0.5

    Release 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

    Release 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

    v1.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

    Release 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

    Release 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

    Release 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.