Created
March 5, 2019 13:44
-
-
Save mohamedelshorbagy/d6da4fb44cd4d283280d3bd8b85f07dc to your computer and use it in GitHub Desktop.
Base64 to Unit8Array
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 base64ToUint8Array(base64String) { | |
let raw = atob(base64String); | |
let uint8Array = new Uint8Array(raw.length); | |
for (let i = 0; i < raw.length; i++) { | |
uint8Array[i] = raw.charCodeAt(i); | |
} | |
let pdfSrc = unit8Array; | |
return pdfSrc; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment