UNPKG

@roochnetwork/rooch-sdk

Version:
21 lines (20 loc) 508 B
function fromB64(base64String) { return Uint8Array.from(atob(base64String), (char) => char.charCodeAt(0)); } const CHUNK_SIZE = 8192; function toB64(bytes) { if (bytes.length < CHUNK_SIZE) { return btoa(String.fromCharCode(...bytes)); } let output = ""; for (let i = 0; i < bytes.length; i += CHUNK_SIZE) { const chunk = bytes.slice(i, i + CHUNK_SIZE); output += String.fromCharCode(...chunk); } return btoa(output); } export { fromB64, toB64 }; //# sourceMappingURL=b64.js.map