NARU API
    Preparing search index...

    Function readBoundedBody

    • Reads a response body without ever holding more than limitBytes.

      A declared Content-Length is checked before anything is allocated and then held to: the reader fills a buffer of exactly that size and fails if the body runs long or short, so a dishonest length cannot grow the allocation and a truncated transfer cannot pass as a complete resource. Without a declared length the body is accumulated against the ceiling and the transfer is cancelled the moment it crosses it.

      Parameters

      • response: Response
      • limitBytes: number
      • label: string

      Returns Promise<Uint8Array<ArrayBufferLike>>