Skip to content

Instantly share code, notes, and snippets.

@mikehibm
Last active August 9, 2018 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikehibm/6272508f3dde2fd4073ad665cf822fb0 to your computer and use it in GitHub Desktop.
Save mikehibm/6272508f3dde2fd4073ad665cf822fb0 to your computer and use it in GitHub Desktop.
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