1base64(3)                  Erlang Module Definition                  base64(3)
2
3
4

NAME

6       base64 - Provides base64 encode and decode, see
7           RFC 2045.
8

DESCRIPTION

10       Provides base64 encode and decode, see RFC 2045.
11

DATA TYPES

13       base64_alphabet() =
14           65..90 | 97..122 | 48..57 | 43 | 47 | 45 | 95 | 61
15
16              Base 64 Encoding alphabet, see RFC 4648.
17
18       base64_mode() = standard | urlsafe
19
20              Selector for the Base 64 Encoding alphabet used for encoding and
21              decoding. See RFC 4648 Sections 4 and 5.
22
23       options() = #{padding => boolean(), mode => base64_mode()}
24
25              Customises the behaviour of the encode and decode functions. De‐
26              fault  value if omitted entirely or partially is #{mode => stan‐
27              dard, padding => true}.
28
29       base64_string() = [base64_alphabet()]
30
31              Base 64 encoded string.
32
33       base64_binary() = binary()
34
35              Base 64 encoded binary.
36
37       byte_string() = [byte()]
38
39              Arbitrary sequences of octets.
40

EXPORTS

42       decode(Base64) -> Data
43
44       decode_to_string(Base64) -> DataString
45
46       mime_decode(Base64) -> Data
47
48       mime_decode_to_string(Base64) -> DataString
49
50              Types:
51
52                 Base64 = base64_string() | base64_binary()
53                 Data = binary()
54                 DataString = byte_string()
55
56              Decodes a base64 string encoded using the standard alphabet  ac‐
57              cording to RFC 4648 Section 4 to plain ASCII.
58
59              mime_decode/1  and  mime_decode_to_string/1  strip  away illegal
60              characters, while decode/1  and  decode_to_string/1  only  strip
61              away whitespace characters.
62
63              Checks  the correct number of = padding characters at the end of
64              the encoded string.
65
66       decode(Base64, Options) -> Data
67
68       decode_to_string(Base64, Options) -> DataString
69
70       mime_decode(Base64, Options) -> Data
71
72       mime_decode_to_string(Base64, Options) -> DataString
73
74              Types:
75
76                 Base64 = base64_string() | base64_binary()
77                 Options = options()
78                 Data = binary()
79                 DataString = byte_string()
80
81              Decodes a base64 string encoded using the alphabet indicated  by
82              the mode option to plain ASCII.
83
84              mime_decode/2  and  mime_decode_to_string/2  strip  away illegal
85              characters, while decode/2  and  decode_to_string/2  only  strip
86              away whitespace characters.
87
88              The mode option can be one of the following:
89
90                standard:
91                  Default.  Decode  the given string using the standard base64
92                  alphabet according to RFC 4648 Section 4, that  is  "+"  and
93                  "/" are representing bytes 62 and 63 respectively, while "-"
94                  and "_" are illegal characters.
95
96                urlsafe:
97                  Decode the given string using the alternative "URL and File‐
98                  name  safe" base64 alphabet according to RFC 4648 Section 5,
99                  that is "-" and "_" are representing bytes 62 and 63 respec‐
100                  tively, while "+" and "/" are illegal characters.
101
102              The padding option can be one of the following:
103
104                true:
105                  Default.  Checks  the correct number of = padding characters
106                  at the end of the encoded string.
107
108                false:
109                  Accepts an encoded string with missing = padding  characters
110                  at the end.
111
112       encode(Data) -> Base64
113
114       encode_to_string(Data) -> Base64String
115
116              Types:
117
118                 Data = byte_string() | binary()
119                 Base64 = base64_binary()
120                 Base64String = base64_string()
121
122              Encodes  a plain ASCII string into base64 using the standard al‐
123              phabet according to RFC 4648 Section 4. The result is 33% larger
124              than the data.
125
126              Always appends correct number of = padding characters to the en‐
127              coded string.
128
129       encode(Data, Options) -> Base64
130
131       encode_to_string(Data, Options) -> Base64String
132
133              Types:
134
135                 Data = byte_string() | binary()
136                 Options = options()
137                 Base64 = base64_binary()
138                 Base64String = base64_string()
139
140              Encodes a plain ASCII string into base64 using the alphabet  in‐
141              dicated  by  the  mode option. The result is 33% larger than the
142              data.
143
144              The mode option can be one of the following:
145
146                standard:
147                  Default. Encode the given string using the  standard  base64
148                  alphabet according to RFC 4648 Section 4.
149
150                urlsafe:
151                  Encode the given string using the alternative "URL and File‐
152                  name safe" base64 alphabet according to RFC 4648 Section 5.
153
154              The padding option can be one of the following:
155
156                true:
157                  Default. Appends correct number of = padding  characters  to
158                  the encoded string.
159
160                false:
161                  Skips appending = padding characters to the encoded string.
162
163
164
165Ericsson AB                      stdlib 5.1.1                        base64(3)
Impressum