ethers.js/packages/base64/lib/base64.js

14 lines
463 B
JavaScript
Raw Permalink Normal View History

2020-11-16 23:07:24 -05:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
2021-03-07 18:24:04 -05:00
exports.encode = exports.decode = void 0;
2020-11-16 23:07:24 -05:00
var bytes_1 = require("@ethersproject/bytes");
function decode(textData) {
2021-10-16 02:29:27 -04:00
return (0, bytes_1.arrayify)(new Uint8Array(Buffer.from(textData, "base64")));
2020-11-16 23:07:24 -05:00
}
exports.decode = decode;
;
function encode(data) {
2021-10-16 02:29:27 -04:00
return Buffer.from((0, bytes_1.arrayify)(data)).toString("base64");
2020-11-16 23:07:24 -05:00
}
exports.encode = encode;
//# sourceMappingURL=base64.js.map