1.0.3 • Published 6 years ago

get-exif v1.0.3

Weekly downloads
13
License
ISC
Repository
github
Last release
6 years ago

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

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.6.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.0

6 years ago