Skip to main content

toBase64()

function toBase64(str: string): string;

Defined in: src/lib/utils.ts:400

Encode a string to Base64. Works in all environments including FiveM client (no btoa/TextEncoder).

Parameters

ParameterTypeDescription
strstringThe string to encode

Returns

string

Base64 encoded string

Example

toBase64("Hello, World!"); // "SGVsbG8sIFdvcmxkIQ=="