ts-mls
Version:
[](https://github.com/LukaJCB/ts-mls/actions/workflows/ci.yml) [](https://badge.fury.io/js/ts-mls) [ {
return b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength);
}
export function bytesToBase64(bytes) {
if (typeof Buffer !== "undefined") {
return Buffer.from(bytes).toString("base64");
}
else {
let binary = "";
bytes.forEach((b) => (binary += String.fromCharCode(b)));
return globalThis.btoa(binary);
}
}
export function base64ToBytes(base64) {
if (typeof Buffer !== "undefined") {
return Uint8Array.from(Buffer.from(base64, "base64"));
}
else {
const binary = globalThis.atob(base64);
const bytes = new Uint8Array(binary.length);
for (let i = 0; i < binary.length; i++) {
bytes[i] = binary.charCodeAt(i);
}
return bytes;
}
}
//# sourceMappingURL=byteArray.js.map