Created
August 22, 2019 11:33
-
-
Save smitroshin/a5c8c54c3995f4c5acef06390df2e6cc to your computer and use it in GitHub Desktop.
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
const toBase64 = file => new Promise((resolve, reject) => { | |
const reader = new FileReader(); | |
reader.readAsDataURL(file); | |
reader.onload = () => resolve(reader.result); | |
reader.onerror = error => reject(error); | |
}); | |
// toBase64(file).then(file => console.log(file)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment