Only spaces and horizontal tabs (OWS) are accepted around the media type
and the ; separators. Any other whitespace, including CR, LF and
Unicode whitespace, is rejected.
Empty parameters (text/html;, text/html; ; charset=utf-8) are accepted,
as allowed by RFC 9110.
type, subtype and parameter names are case-insensitive and are
lower-cased. Parameter values are returned as-is.
Quoted-pairs in quoted-string values are unescaped.
When a parameter appears more than once, the first occurrence wins, matching
util.MIMEType, the WHATWG MIME Sniffing Standard
and the content-type package.
parameters is a null-prototype object, so parameter names such as
__proto__ or constructor are ordinary keys.
Benchmarks
npm run benchmarkBenchmarking: "application/json; charset=utf-8"util#MIMEType x 2,637,188 ops/sec ±0.95% (93 runs sampled)fast-content-type-parse#parse x 5,165,077 ops/sec ±0.75% (95 runs sampled)fast-content-type-parse#safeParse x 5,189,599 ops/sec ±0.72% (94 runs sampled)content-type#parse x 4,227,069 ops/sec ±0.79% (96 runs sampled)busboy#parseContentType x 777,787 ops/sec ±0.75% (91 runs sampled)Fastest is fast-content-type-parse#safeParse,fast-content-type-parse#parse