JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q53879F
  • License ISC

Get Exif data from JPEG data

Package Exports

  • get-exif

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (get-exif) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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);
  • read-exif — Get Exif data from a file instead of a Buffer or string

License

ISC License © 2018 - 2019 Shinnosuke Watanabe