# What changed in raw-body

> 13 changes in raw-body 4 from its official release notes, upgrade guides and advisories: 9 breaking, 2 new APIs and options. Each one cited. Sources checked 2026-10-18. HTML: https://unstale.sh/npm/raw-body/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## raw-body 4

### Breaking changes

- When no callback is provided, the function no longer checks for a global Promise. (4.0.0) — [release notes](https://github.com/stream-utils/raw-body/releases/tag/v4.0.0)
- 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.0) — [release notes](https://github.com/stream-utils/raw-body/releases/tag/v4.0.0)
- 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.0) — [release notes](https://github.com/stream-utils/raw-body/releases/tag/v4.0.0)
- 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.0) — [release notes](https://github.com/stream-utils/raw-body/releases/tag/v4.0.0)
- Streams destroyed without an error now settle through the callback or rejected promise with a 400 request.aborted error. (4.0.0) — [release notes](https://github.com/stream-utils/raw-body/releases/tag/v4.0.0)
- 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.0) — [release notes](https://github.com/stream-utils/raw-body/releases/tag/v4.0.0)
- The package is now ESM-only; CommonJS consumers can continue loading it through require(esm). (4.0.0) — [release notes](https://github.com/stream-utils/raw-body/releases/tag/v4.0.0)
- Decoding no longer detects a big-endian BOM and always uses little-endian; use utf-16be for big-endian content. (4.0.0) — [release notes](https://github.com/stream-utils/raw-body/releases/tag/v4.0.0)
- Supported encodings now follow the WHATWG Encoding Standard; unsupported encodings throw a 415 error. (4.0.0) — [release notes](https://github.com/stream-utils/raw-body/releases/tag/v4.0.0)

### New APIs and options

- A custom decoder compatible with iconv-lite's getDecoder can decode encodings outside the WHATWG Encoding Standard. (4.0.0) — [release notes](https://github.com/stream-utils/raw-body/releases/tag/v4.0.0)
- New export reads WHATWG ReadableStream bodies with the same options as getRawBody; getRawBody itself continues to accept only node streams. (4.0.0) — [release notes](https://github.com/stream-utils/raw-body/releases/tag/v4.0.0)

### Fixes and other changes

- A custom decoder throwing while reading node streams no longer crashes the process. (4.0.0) — [release notes](https://github.com/stream-utils/raw-body/releases/tag/v4.0.0)
- Unparseable length values are treated as no expected length, avoiding request failures caused by values that parse to NaN. (4.0.0) — [release notes](https://github.com/stream-utils/raw-body/releases/tag/v4.0.0)
