Created
December 28, 2020 10:16
-
-
Save Dexdot/b745ae7a9bc64cecf88adbd96713c5bd 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
export async function getImageUrl(file: File): Promise<string | ArrayBuffer> { | |
return new Promise((resolve) => { | |
import('exif-js') | |
.then((EXIF) => { | |
EXIF.getData(file, function onGetData() { | |
const reader = new FileReader(); | |
reader.onload = ({ target }) => { | |
resolve(target.result); | |
}; | |
reader.readAsDataURL(this); | |
}); | |
}) | |
.catch((e) => { | |
console.error(e); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment