get-exif

1.0.3 • Public • Published

get-exif

npm version Build Status Coverage Status

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

Use npm.

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 or string

License

ISC License © 2018 - 2019 Shinnosuke Watanabe

Package Sidebar

Install

npm i get-exif

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

6.67 kB

Total Files

4

Last publish

Collaborators

  • shinnn