(buf: ArrayBuffer)
| 1 | export function arrayBufferToBase64(buf: ArrayBuffer): string { |
| 2 | const bytes = new Uint8Array(buf); |
| 3 | let binary = ""; |
| 4 | const chunkSize = 0x8000; |
| 5 | for (let i = 0; i < bytes.length; i += chunkSize) { |
| 6 | binary += String.fromCharCode(...bytes.subarray(i, i + chunkSize)); |
| 7 | } |
| 8 | return btoa(binary); |
| 9 | } |
| 10 |
no outgoing calls
no test coverage detected