1.0.3 • Published 6 years ago
get-exif v1.0.3
get-exif
A Node.js module to get Exif data from JPEG data
const {readFile} = require('fs').promises;
const getExif = require('exif');
(async () => {
const exif = getExif(await readFile('example.jpg')).Exif;
// 33434: ID of the `ExposureTime` tag
exif['33434']; //=> [1, 100]
// 36867: ID of the `DateTimeOriginal` tag
exif['36867']; //=> '2017:11:19 08:47:19'
})();
Installation
npm install get-exif
API
const getExif = require('get-exif');
getExif(data)
data: Buffer | string
(data of a JPEG file)
Return: Object
It reads Exif data from a Buffer
using Piexifjs and return it as an Object
.
imageBuffer; //=> <Buffer ff d8 ff e1 94 41 45 78 69 66 00 00 49 49 2a ...>
getExif(imageBuffer); /*=> {
'0th': { ... },
'1st': { ... },
Exif: { ... },
GPS: { ... }
Interop: { ... },
thumbnail: ' ... '
} */
It also accepts a Buffer
-to-latin1
encoded string.
imageString; //=> 'ÿØÿáAExif\u0000\u0000II*\u0000\b\u0000 ...'
getExif(imageString);
Related
- read-exif — Get Exif data from a file instead of a
Buffer
orstring
License
ISC License © 2018 - 2019 Shinnosuke Watanabe