base64 (stdlib v3.15.2)

Provides base64 encode and decode, see RFC 2045.

Link to this section Summary

Types

Base 64 Encoding alphabet, see RFC 4648.

Base 64 encoded binary.

Base 64 encoded string.

Arbitrary sequences of octets.

Functions

Decodes a base64-encoded string to plain ASCII. See RFC 4648.

Encodes a plain ASCII string into base64. The result is 33% larger than the data.

Link to this section Types

Link to this type

-type base64_alphabet() :: term().

Specs

base64_alphabet() :: $A..$Z | $a..$z | $0..$9 | $+ | $/ | $=.

Base 64 Encoding alphabet, see RFC 4648.

Link to this type

-type base64_binary() :: term().

Specs

base64_binary() :: binary().

Base 64 encoded binary.

Link to this type

-type base64_string() :: term().

Specs

base64_string() :: [base64_alphabet()].

Base 64 encoded string.

Link to this type

-type byte_string() :: term().

Specs

byte_string() :: [byte()].

Arbitrary sequences of octets.

Link to this section Functions

Specs

decode(Base64) -> Data when Base64 :: base64_string() | base64_binary(), Data :: binary().

Decodes a base64-encoded string to plain ASCII. See RFC 4648.

mime_decode/1 and mime_decode_to_string/1 strip away illegal characters, while decode/1 and decode_to_string/1 only strip away whitespace characters.

Link to this function

decode_to_string/1

Specs

decode_to_string(Base64) -> DataString
                    when Base64 :: base64_string() | base64_binary(), DataString :: byte_string().

Specs

encode(Data) -> Base64 when Data :: byte_string() | binary(), Base64 :: base64_binary().

Encodes a plain ASCII string into base64. The result is 33% larger than the data.

Link to this function

encode_to_string/1

Specs

encode_to_string(Data) -> Base64String
                    when Data :: byte_string() | binary(), Base64String :: base64_string().

Specs

mime_decode(Base64) -> Data when Base64 :: base64_string() | base64_binary(), Data :: binary().
Link to this function

mime_decode_to_string/1

Specs

mime_decode_to_string(Base64) -> DataString
                         when
                             Base64 :: base64_string() | base64_binary(),
                             DataString :: byte_string().