@9wick/esptool.js
Version:
TypeScript/Nodejs port of the esptool
33 lines • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.btoa = exports.atob = exports.atobuff = void 0;
function atobuff(base64) {
const buf = Buffer.from(base64, "base64");
return buf;
}
exports.atobuff = atobuff;
function atob(base64) {
if (typeof window !== "undefined" && window.atob) {
return window.atob(base64);
}
else if (typeof Buffer !== "undefined") {
const buf = Buffer.from(base64, "base64");
const ascii = buf.toString("ascii");
return ascii;
}
throw new Error("unsupported environment");
}
exports.atob = atob;
function btoa(ascii) {
if (typeof window !== "undefined" && window.atob) {
return window.btoa(ascii);
}
else if (typeof Buffer !== "undefined") {
const buf = Buffer.from(ascii, "ascii");
const base64 = buf.toString("base64");
return base64;
}
throw new Error("unsupported environment");
}
exports.btoa = btoa;
//# sourceMappingURL=util.js.map