Skip to content

Instantly share code, notes, and snippets.

@dirkarnez
Created August 1, 2019 10:50
Show Gist options
  • Select an option

  • Save dirkarnez/2a3e5be9bb0f42477930868ec24495f2 to your computer and use it in GitHub Desktop.

Select an option

Save dirkarnez/2a3e5be9bb0f42477930868ec24495f2 to your computer and use it in GitHub Desktop.
ArrayBuffer To Base64
function arrayBufferToBase64(data: ArrayBuffer) {
var binary = "";
var bytes = new Uint8Array(data);
for (var len = bytes.byteLength, i = 0; i < len; i++) {
binary += String.fromCharCode(bytes[i]);
}
return window.btoa(binary);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment