ethers.js/lib.esm/utils/base64-browser.js
2022-09-15 22:58:45 -04:00

19 lines
575 B
JavaScript

// utils/base64-browser
import { getBytes } from "./data.js";
export function decodeBase64(textData) {
textData = atob(textData);
const data = new Uint8Array(textData.length);
for (let i = 0; i < textData.length; i++) {
data[i] = textData.charCodeAt(i);
}
return getBytes(data);
}
export function encodeBase64(_data) {
const data = getBytes(_data);
let textData = "";
for (let i = 0; i < data.length; i++) {
textData += String.fromCharCode(data[i]);
}
return btoa(textData);
}
//# sourceMappingURL=base64-browser.js.map