Skip to content

urlsafeB64encode

urlsafeB64encode(s: string | Uint8Array<ArrayBufferLike>): Uint8Array

Defined in: packages/pythonlib/src/base64.ts:121

Encode bytes-like object using URL-safe Base64 and return bytes.

URL-safe Base64 uses - instead of + and _ instead of /, and omits padding characters.

Parameters

ParameterTypeDescription
sstring | Uint8Array<ArrayBufferLike>Bytes to encode

Returns

Uint8Array

URL-safe Base64 encoded Uint8Array

Example

const encoded = urlsafeB64encode(new Uint8Array([255, 239]))
// Uses - and _ instead of + and /