2D Run-and-gun shooter inspired by One Man's Doomsday, Counter-Strike, and Metal Slug.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

21 lines
475 B

  1. export const readFile = async (file: File) => {
  2. const fileReader = new FileReader()
  3. return new Promise<string>((resolve, reject) => {
  4. fileReader.addEventListener('load', (e) => {
  5. if (!e.target) {
  6. reject(new Error('Invalid target'))
  7. return;
  8. }
  9. resolve(e.target.result as string);
  10. })
  11. fileReader.addEventListener('error', () => {
  12. reject(new Error('Error reading file'))
  13. });
  14. fileReader.readAsText(file);
  15. });
  16. }