Skip to content

Instantly share code, notes, and snippets.

@paul-vd
Created May 16, 2020 20:05
Show Gist options
  • Save paul-vd/2c3eaa37aba81172f384fd3ed564d6f3 to your computer and use it in GitHub Desktop.
Save paul-vd/2c3eaa37aba81172f384fd3ed564d6f3 to your computer and use it in GitHub Desktop.
Array Buffer to Base64
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