Streams a fetch Response body into a Buffer, enforcing a total size limit.
Checks the content-length header first for an early rejection, then accumulates chunks and throws as soon as the running total exceeds maxBytes.
content-length
maxBytes
An already-fetched Response with an OK status.
Maximum number of bytes allowed.
Error message thrown when the limit is exceeded.
The full response body as a Buffer.
When content-length exceeds the limit, the body exceeds the limit while streaming, or the body is unreadable.
Streams a fetch Response body into a Buffer, enforcing a total size limit.
Checks the
content-lengthheader first for an early rejection, then accumulates chunks and throws as soon as the running total exceedsmaxBytes.