Skip to content

Instantly share code, notes, and snippets.

@sainf
Created February 20, 2020 12:29
Show Gist options
  • Save sainf/9da63a3f7d5c6b6e5110478f373bcc0d to your computer and use it in GitHub Desktop.
Save sainf/9da63a3f7d5c6b6e5110478f373bcc0d to your computer and use it in GitHub Desktop.
readFileAsync(file) {
return new Promise((resolve, reject) => {
let reader = new FileReader()
reader.onload = () => {
resolve(reader.result)
}
reader.onerror = reject
reader.readAsDataURL(file)
})
}
let file = await readFileAsync(fileObject)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment