Module base64

An implementation of a subset of the Erlang/OTP base64 interface.

Description

This module is designed to be API-compatible with the Erlang/OTP base64 module, with the following exceptions:

  • No support for decoding data with whitespace in base64 data

  • No support for mime decoding functions

Function Index

decode/1 Base-64 decode a binary or string, outputting a binary.
decode_to_string/1 Base-64 decode a binary or string, outputting a string.
encode/1 Base-64 encode a binary or string, outputting a binary.
encode_to_string/1 Base-64 encode a binary or string, outputting a string.

Function Details

decode/1


decode(Data::binary() | iolist()) -> binary()

Data: the data to decode

returns: the base-64 data decoded, as a binary

Base-64 decode a binary or string, outputting a binary.

This function will raise a badarg exception if the supplied data is not valid base64-encoded data.

decode_to_string/1


decode_to_string(Data::binary() | iolist()) -> string()

Data: the data to decode

returns: the base-64 data decoded, as a string

Base-64 decode a binary or string, outputting a string.

This function will raise a badarg exception if the supplied data is not valid base64-encoded data.

encode/1


encode(Data::binary() | iolist()) -> binary()

Data: the data to encode

returns: the base-64 data encoded, as a binary

Base-64 encode a binary or string, outputting a binary.

encode_to_string/1


encode_to_string(Data::binary() | iolist()) -> string()

Data: the data to encode

returns: the base-64 data encoded, as a string

Base-64 encode a binary or string, outputting a string.