providerplaneai
    Preparing search index...
    • 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.

      Parameters

      • response: Response

        An already-fetched Response with an OK status.

      • maxBytes: number

        Maximum number of bytes allowed.

      • sizeErrorMessage: string

        Error message thrown when the limit is exceeded.

      Returns Promise<Buffer<ArrayBufferLike>>

      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.