unstale

npm / raw-body

raw-body

What changed in raw-body 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.

9 breaking2 new APIs and options2 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.1.1 on npm

raw-body 413 changes

Breaking changes 9

  • When no callback is provided, the function no longer checks for a global Promise.

    4.0.0release notes

  • A body exceeding its declared length now errors with 400 request.size.invalid as soon as excess bytes arrive, bounding memory even without a limit; length overruns take precedence over limit errors.

    4.0.0release notes

  • A limit that does not parse to a byte count now throws a TypeError instead of silently reading without a limit; limit: null explicitly disables the limit.

    4.0.0release notes

  • Streams1 support is removed. Streams must implement the readable stream interface; string chunks now error with 500 stream.encoding.set through the callback.

    4.0.0release notes

  • Streams destroyed without an error now settle through the callback or rejected promise with a 400 request.aborted error.

    4.0.0release notes

  • Node.js versions prior to 22 are no longer supported because the package relies on require(esm), which does not work correctly on earlier versions.

    4.0.0release notes

  • The package is now ESM-only; CommonJS consumers can continue loading it through require(esm).

    4.0.0release notes

  • Decoding no longer detects a big-endian BOM and always uses little-endian; use utf-16be for big-endian content.

    4.0.0release notes

  • Supported encodings now follow the WHATWG Encoding Standard; unsupported encodings throw a 415 error.

    4.0.0release notes

New APIs and options 2

  • A custom decoder compatible with iconv-lite's getDecoder can decode encodings outside the WHATWG Encoding Standard.

    4.0.0release notes

  • New export reads WHATWG ReadableStream bodies with the same options as getRawBody; getRawBody itself continues to accept only node streams.

    4.0.0release notes

Fixes and other changes 2

  • A custom decoder throwing while reading node streams no longer crashes the process.

    4.0.0release notes

  • Unparseable length values are treated as no expected length, avoiding request failures caused by values that parse to NaN.

    4.0.0release notes