RingoJS

Module ringo/base64

Base64 encoding and decoding for binary data and strings.

Functions


decode (str, encoding)

Decodes a Base64 encoded string to a string or byte array.

Parameters

String str

the Base64 encoded string

String encoding

the encoding to use for the return value. Defaults to 'utf8'. Use 'raw' to get a ByteArray instead of a string.

Returns

the decoded string or ByteArray


encode (str, encoding)

Encode a string or binary to a Base64 encoded string

Parameters

String|Binary str

a string or binary

String encoding

optional encoding to use if first argument is a string. Defaults to 'utf8'.

Returns

the Base64 encoded string