raw-body
4.0.0 · 12 Jul 2026MIT209.5M / weekRepositoryHomepagenpmAtom feed
Where each line stands
Plan an upgradeLatest releases
All 53 releases- 4.x · latest line
4.0.0
12 Jul 2026- Breaking
Remove support for Node <22
Node.js versions prior to 22 are no longer supported. This allows the package to migrate to ESM and rely on
require(esm), which does not work correctly on earlier versions. - Breaking
Migrate to TypeScript and publish as ESM-only
CommonJS consumers can keep loading the package through
require(esm). - Breaking
Use native
TextDecoderinstead oficonv-liteSupported encodings are now those of the WHATWG Encoding Standard; encodings outside the standard (e.g. UTF-32) now throw a 415 error.
utf-16no longer detects a big-endian BOM and always decodes as little-endian; useutf-16befor big-endian content.
Breaking changes
- Breaking
Remove support for Node <22
Node.js versions prior to 22 are no longer supported. This allows the package to migrate to ESM and rely on
require(esm), which does not work correctly on earlier versions. - Breaking
Migrate to TypeScript and publish as ESM-only
CommonJS consumers can keep loading the package through
require(esm). - Breaking
Use native
TextDecoderinstead oficonv-liteSupported encodings are now those of the WHATWG Encoding Standard; encodings outside the standard (e.g. UTF-32) now throw a 415 error.
utf-16no longer detects a big-endian BOM and always decodes as little-endian; useutf-16befor big-endian content. - Breaking
Remove streams1 support
Node streams that emit string chunks now error with a 500
stream.encoding.setthrough the callback (previously they were decoded silently, or crashed the process when no encoding was set), matching the web stream path. Streams are expected to implement the readable stream interface (unpipe,pause). - Breaking
Validate the
limitoptionA
limitthat does not parse to a byte count (e.g.'banana',NaN) now throws aTypeErrorinstead of silently reading with no limit at all.limit: nullremains the explicit way to disable the limit.
Improvements
Support reading WHATWG
ReadableStream(web streams) through the newgetRawBodyWebexportfetchRequest/Responsebodies,Blob.stream(),TransformStreamreadables, andReadable.toWeb()bridges can be read withgetRawBodyWeb, which takes the same options asgetRawBody;getRawBodyitself keeps accepting only node streams. Streams already locked, read, or cancelled error with a 500stream.not.readable; client aborts are mapped to the same 400request.abortederror as node streams, with the original error incause; string chunks are accepted without an encoding (UTF-8Buffer), but error with a 500stream.encoding.setwhen combined with one, since the stream is already decoded; non-byte chunks (e.g.ArrayBuffer) error with aTypeError. On error the reader lock is released, but the stream is not cancelled; disposing it is up to the caller.Add a custom
decoderoptionA function compatible with
iconv-lite'sgetDecodercan be plugged in to decode encodings outside the WHATWG Encoding Standard.Use native
stream.unpipe()and remove theunpipedependencyRemove the check for a global
Promisewhen no callback is providedAdd a benchmark suite
npm run benchcompares the node and web stream paths with realistic request bodies.Fail as soon as a stream exceeds its declared
lengthA body that sends more bytes than its declared
lengthnow errors with a 400request.size.invalidas soon as the excess arrives, rather than buffering the rest first. This bounds memory tolengtheven when nolimitis set. When both are set, alengthoverrun is reported before thelimit's 413.
Bug fixes
Fix a
lengththat does not parse to a number failing every requestValues like
''passed the numeric pre-check but parsed toNaN, so the size check could never match and every request errored with a 400request.size.invalid. They are now treated as no expected length, like any other unparseable value.Fix node streams destroyed without an error never settling
They now error through the callback / reject the promise with the same 400
request.abortederror as the web path, instead of never invoking the callback or settling the promise.Fix process crash when a custom
decoderthrows while reading node streams
- 3.x · maintenance
3.0.2
21 Nov 2025Only updates dependencies:http-errors 2.0.1statuses 2.0.2
3.0.1
4 Sep 2025Fix the engines field to reflect support for Node >= 0.10
What's Changed
Bug fixes
Fix the engines field to reflect support for Node >= 0.10
Dependency tracking · free for 3 projects
Know when your own dependencies move
raw-body shipped a new major in the last 12 months, among 3 releases. inlinr shows which of your projects are behind, and what the upgrade breaks.
Advisories reach you
An email when a critical or high advisory affects a project, before the next install.
Upgrades checked first
Peer ranges, Node, ESM-only and types changes read before you bump.
Only what matters
Majors and breaking notes stay; patches and sibling bumps fold into one line.
Reading releases, release notes and advisories…
Registry facts last checked 9 Nov 2026. Releases and advisories last read 9 Nov 2026.