import type { IncomingMessage } from 'node:http'; type BodyReadResult = { ok: true; body: Buffer; } | { ok: false; reason: 'too_large' | 'read_error'; }; /** * Reads the request body up to `maxBytes`. * * A socket error is reported as `read_error`, NOT as `too_large`. The failure type had only one * member, so the error path was forced to claim the body exceeded the limit — a client that * disconnected mid-upload, or any transport fault, was recorded and answered as an oversized * payload. That is the same misattribution the envelope layer removed when it split cancellation * out of `error`: a cause the operator did not have is worse than no cause at all. * If the body exceeds `maxBytes`, drains remaining data and resolves with * { ok: false, reason: 'too_large' } so the server can still send a 413 response * before closing the connection. */ export declare function readBody(req: IncomingMessage, maxBytes: number): Promise; export {}; //# sourceMappingURL=body-reader.d.ts.map