openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
22 lines (21 loc) • 780 B
TypeScript
/** Reads a response body under a byte cap, cancelling the stream on overflow or idle timeout. */
export declare function readResponseWithLimit(res: Response, maxBytes: number, opts?: {
onOverflow?: (params: {
size: number;
maxBytes: number;
res: Response;
}) => Error;
chunkTimeoutMs?: number;
onIdleTimeout?: (params: {
chunkTimeoutMs: number;
}) => Error;
}): Promise<Buffer>;
/** Reads a small collapsed text prefix from a response body for diagnostics/errors. */
export declare function readResponseTextSnippet(res: Response, opts?: {
maxBytes?: number;
maxChars?: number;
chunkTimeoutMs?: number;
onIdleTimeout?: (params: {
chunkTimeoutMs: number;
}) => Error;
}): Promise<string | undefined>;