import { Buffer } from 'buffer'; import { MaybePromise } from '@httptoolkit/util'; import { CompletedBody, Headers } from "../types"; import { Replace } from "../util/type-utils"; export type SerializedBody = string | { encoded: string; decoded: string; decodingError: undefined; } | { encoded: string; decoded: undefined; decodingError: undefined; } | { encoded: string; decodingError: string; decoded: undefined; }; export declare function withSerializedBodyReader(input: T, bodySerializer: BodySerializer): Promise>; export type BodySerializer = (body: CompletedBody, headers: Headers) => MaybePromise; export declare function withDeserializedBodyReader(input: Replace): T; export declare function deserializeBodyReader(encodedBodyString: string, decodedBodyString: string | undefined, decodingError: string | undefined, headers: Headers): CompletedBody; /** * Serialize a callback result (callback handlers, BeforeRequest/Response etc) * to transform all the many possible buffer formats into either base64-encoded * buffer data, or undefined. */ export declare function withSerializedCallbackBuffers(input: T): Replace; export type WithSerializedCallbackBuffers = Replace; /** * Deserialize a callback result (callback handlers, BeforeRequest/Response etc) * to build buffer data (or undefined) from the base64-serialized data * produced by withSerializedCallbackBuffers */ export declare function withDeserializedCallbackBuffers(input: Replace): T; //# sourceMappingURL=body-serialization.d.ts.map