Created
June 25, 2018 15:57
-
-
Save Troland/58fc49be963e8dbe976200eaa15b0bd4 to your computer and use it in GitHub Desktop.
Transform blob to base64 encoded string
This file contains 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 blobToDataURL(blob) { | |
return new Promise((fulfill, reject) => { | |
let reader = new FileReader(); | |
reader.onerror = reject; | |
reader.onload = (e) => fulfill(reader.result); | |
reader.readAsDataURL(blob); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment