Skip to content
1 min read · 70 words

Function: encodeBase64()

ts
function encodeBase64(bytes: Uint8Array): string;

Defined in: src/lib/helpers/base64.ts:33

Encode a Uint8Array as a base64 string.

Parameters

ParameterTypeDescription
bytesUint8ArrayThe buffer to encode.

Returns

string

The base64 representation.

Remarks

Prefers Buffer.from(bytes).toString('base64') when globalThis.Buffer exists; otherwise chunk-encodes through btoa with a 0x8000-byte window to avoid Maximum call stack size exceeded on large buffers.