Created
August 9, 2017 09:18
-
-
Save frumbert/3bf7a68ffa2ba59061bdcfc016add9ee to your computer and use it in GitHub Desktop.
blob to dataurl, because I keep forgetting how to do it!
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
Superb! Thanks.