base64Encoding(input: string | ArrayBuffer, encoding?: "std" | "rawstd" | "url" | "rawurl"): string
Parameter | Type | Description |
input | string or ArrayBuffer. | The string or byte array to be encoded. |
encoding (optional) | "std", "rawstd", "url", or "rawurl". | Optional; represents the different encoding methods mentioned above. Defaults to "std" if left blank. |
Type | Description |
string | The result obtained through Base64 encoding. |
import util from 'pts/util';export default function () {// SGVsbG8sIHdvcmxkconsole.log(util.base64Encoding('Hello, world'));}
import util from 'pts/util';export default function () {// aHR0cDovL3d3dy5leGFtcGxlLmNvbQ==console.log(util.base64Encoding('http://www.example.com', 'url'));}