base64.decode

Decodes a base64-encoded string into bytes.

Syntax

decode(string)

Parameters

Return value

A Uint8Array with decoded bytes.

Throws an error if the string is not a valid base64 string.

Example

base64.decode("AQID/w==")
Uint8Array [1, 2, 3, 255]
base64.decode("AQ")
TypeError: failed to decode data