forked from MikeKovarik/exifr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathesm.mjs
25 lines (20 loc) · 961 Bytes
/
esm.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// NOTE: this code is isomorphic and can be executed with node or ran with browser.
// It uses the new ES Modules and import syntax which might not be implemented in your
// browser or version of Node.
// To run this script in node, use 'node --experimental-modules gps.js'
// To run this in browser, use latest version of Chrome or Edge and make sure your
// http server serves files with .js extensions with the type/javascript mime.
// Also the module imports 'fs' module and it fails in browsers. For that you could
// use newly drafted importmaps.
import * as exifr from '../dist/full.esm.mjs'
async function main() {
var exif = await exifr.gps('../test/fixtures/IMG_20180725_163423.jpg')
if (typeof document !== 'undefined') {
document.write('latitude' + exif.latitude)
document.write('longitude' + exif.longitude)
} else {
console.log('latitude ', exif.latitude)
console.log('longitude', exif.longitude)
}
}
main().catch(console.error)