Created
May 16, 2020 20:05
-
-
Save paul-vd/2c3eaa37aba81172f384fd3ed564d6f3 to your computer and use it in GitHub Desktop.
Array Buffer to Base64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function arrayBufferToBase64(buffer:ArrayBuffer) { | |
let binary = '' | |
const bytes = new Uint8Array(buffer) | |
bytes.forEach(b => (binary += String.fromCharCode(b))) | |
return window.btoa(binary) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment