Skip to content

Instantly share code, notes, and snippets.

@mohamedelshorbagy
Created March 5, 2019 13:44
Show Gist options
  • Save mohamedelshorbagy/d6da4fb44cd4d283280d3bd8b85f07dc to your computer and use it in GitHub Desktop.
Save mohamedelshorbagy/d6da4fb44cd4d283280d3bd8b85f07dc to your computer and use it in GitHub Desktop.
Base64 to Unit8Array
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