Module based.64.rfc
Implements RFC 4648 Base64
Functions
encode (data) | Encodes a value into URL-Safe Base64. |
decode (data[, mode="string"]) | Decodes a Base64-encoded value. |
Functions
- encode (data)
-
Encodes a value into URL-Safe Base64.
Supported types are string and
number
. Strings will be encoded byte-wise with padding bits at the end, while numbers will be encoded all at once with leading zeroes at the start.Parameters:
- data string A string treated as binary data
Returns:
-
string
The Base64 encoded input data
- decode (data[, mode="string"])
-
Decodes a Base64-encoded value.
Parameters:
- data string Base64 encoded data
- mode string Either ‘string’ or ‘number’ to specify what type to decode as (default "string")
Returns:
- The decoded input data
-
boolean
true
if the input data was correctly padded,false
otherwise