Created
August 1, 2019 10:50
-
-
Save dirkarnez/2a3e5be9bb0f42477930868ec24495f2 to your computer and use it in GitHub Desktop.
ArrayBuffer To Base64
This file contains hidden or 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(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