/** * Base64 encoding for binary data. * * Used by the request layer (`request.ts`) and session recording * (`extensions/replay/session-recording.ts`) to send gzip-compressed bodies * over `navigator.sendBeacon` as **text** rather than as a binary `Blob`. * * Why this exists: * * `sendBeacon(url, blob)` with a binary `Blob` (e.g. a gzipped Uint8Array) * is racy. Browsers queue the beacon synchronously, then serialize the * body to the network *after* the JS context has been torn down on * `pagehide` / tab discard. If the underlying `ArrayBuffer` is detached * or GC'd before that flush, the wire body ends up empty or truncated — * while the URL we already committed still carries `?compression=gzip-js`. * The server then tries `gunzipSync` against an empty buffer and throws * `Z_BUF_ERROR: unexpected end of file`. * * Sending the gzip bytes as a base64 *string* sidesteps the problem * entirely: `Blob([string])` owns its own UTF-8 encoded copy, and * `sendBeacon` is reliable for text bodies. The server already accepts * `?compression=base64` for this exact path. */ /** * Encode a `Uint8Array` to a base64 string using `btoa`. * * Chunks the bytes through `String.fromCharCode` so we don't blow the * argument-count limit on `apply()` for large buffers. */ export declare function uint8ArrayToBase64(bytes: Uint8Array): string;