Last active
August 9, 2018 23:13
-
-
Save mikehibm/6272508f3dde2fd4073ad665cf822fb0 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
function readFileAsText(file: Blob): Promise<string> { | |
return new Promise<string>((resolve, reject) => { | |
const reader = new FileReader(); | |
reader.onerror = () => reject(reader.error); | |
reader.onload = () => resolve((reader.result as string) || ''); | |
reader.readAsText(file); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment