Last active
March 15, 2018 22:34
-
-
Save colbydauph/d1c49a692811d577ecdecbad3c22b1dc to your computer and use it in GitHub Desktop.
Get File data url
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
// @async File -> DataUrl | |
const fileDataUrl = (file) => { | |
return new Promise((resolve, reject) => { | |
const reader = new FileReader(); | |
reader.onload = () => resolve(reader.result); | |
reader.onerror = reject; | |
reader.readAsDataURL(file); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment