Skip to content

transitive-bullshit/p-exiftool

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

p-exiftool

Wrapper around exiftool for reading metadata from many different file types.

NPM Build Status JavaScript Style Guide

  • supports many different file types
  • supports common media types like png, jpg, gif, mp4, etc.
  • extracts metadata such as resolution, author, duration, etc.
  • supports gif frame count and duration
  • converts metadata keys to camel-case for consistency

Install

This module requires node >= 8.

Mac OS X

brew install exiftool

npm install --save p-exiftool

Ubuntu

sudo apt-get update
sudo apt-get install libimage-exiftool-perl

npm install --save p-exiftool

See more details on installing exiftool.

Usage

const exiftool = require('p-exiftool')

const metadata = await exiftool('./media/bubbles.gif')
console.log(metadata)
{
  "fileName": "bubbles.gif",
  "fileSize": 2419689,
  "fileType": "GIF",
  "fileTypeExtension": "GIF",
  "mimeType": "image/gif",
  "gifVersion": "89a",
  "imageWidth": 360,
  "imageHeight": 360,
  "hasColorMap": 128,
  "colorResolutionDepth": 8,
  "bitsPerPixel": 8,
  "backgroundColor": 0,
  "animationIterations": 0,
  "frameCount": 28,
  "duration": 1.45,
  "imageSize": "360x360"
}

API

exiftool(...args)

Returns: Promise<Object> or Promise<Array<Object>>

You may pass multiple files to exiftool, in which case, a Promise for an array of results will be returned. If you only pass a single file, a single object will be returned.

args

Type: String Required

Path to one or more image files.

Note that you may also pass extra command-line flags to exiftool here as well. The default flags are -j -n.

Related

License

MIT © Travis Fischer

Support my OSS work by following me on twitter twitter

About

Wrapper around exiftool for reading metadata from many different file types.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published