ethers.js/lib.commonjs/utils/base64.js

20 lines
610 B
JavaScript
Raw Normal View History

2022-09-05 23:57:11 +03:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.encodeBase64 = exports.decodeBase64 = void 0;
2022-09-16 05:58:45 +03:00
const data_js_1 = require("./data.js");
/**
* Decodes the base-64 encoded %%base64Data%%.
*/
function decodeBase64(base64Data) {
return (0, data_js_1.getBytesCopy)(Buffer.from(base64Data, "base64"));
2022-09-05 23:57:11 +03:00
}
exports.decodeBase64 = decodeBase64;
;
2022-09-16 05:58:45 +03:00
/**
* Encodes %%data%% as base-64 encoded data.
*/
2022-09-05 23:57:11 +03:00
function encodeBase64(data) {
2022-09-16 05:58:45 +03:00
return Buffer.from((0, data_js_1.getBytes)(data)).toString("base64");
2022-09-05 23:57:11 +03:00
}
exports.encodeBase64 = encodeBase64;
//# sourceMappingURL=base64.js.map