@lifi/sdk
Version:
LI.FI Any-to-Any Cross-Chain-Swap SDK
13 lines (11 loc) • 331 B
text/typescript
export function uint8ArrayToBase64(bytes: Uint8Array): string {
// Node.js environment
if (typeof Buffer !== 'undefined') {
return Buffer.from(bytes).toString('base64')
}
// Browser environment
const binaryString = Array.from(bytes, (byte) =>
String.fromCharCode(byte)
).join('')
return btoa(binaryString)
}