Skip to main content

readBounded

@retinue/monorepo


@retinue/monorepo / backend/src / readBounded

Function: readBounded()

readBounded(response, maxBytes): Promise<{ text: string; truncated: boolean; }>

Defined in: backend/src/toolkit/http.ts:325

Read at most maxBytes, stopping as they arrive, and abandon the rest.

Without reader.cancel() the connection stays open pulling a body nobody wants.

Parameters​

response​

body?​

unknown

text​

maxBytes​

number

Returns​

Promise<{ text: string; truncated: boolean; }>