Simple library for working with base64 strings
- toBase64(str) - convert a string to base64
- fromBase64(str) - parse a base64 encoded string
Example
const str = 'Hello';
utils.base64.toBase64(str); // 'SGVsbG8=';
const b64Str = 'SGVsbG8=';
utils.base64.fromBase64(b64Str); // 'Hello';
Methods
(static) fromBase64(str) → {String}
Transfers a base64 string back.
Example
const b64Str = 'SGVsbG8=';
utils.base64.fromBase64(b64Str); // 'Hello';
Parameters:
Name | Type | Description |
---|---|---|
str |
String | base64 encoded string |
Returns:
- decoded string
- Type
- String
(static) toBase64(str) → {String}
Convert a string to base64
Example
const str = 'Hello';
utils.base64.toBase64(str); // 'SGVsbG8=';
Parameters:
Name | Type | Description |
---|---|---|
str |
String | string to be converted |
Returns:
- base64 encoding of the string
- Type
- String