p-exiftool
v1.0.1
Published
Wrapper around exiftool for reading metadata from many different file types.
Downloads
6
Maintainers
Readme
p-exiftool
Wrapper around exiftool for reading metadata from many different file types.
- 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
- exiftool - Underlying binary exiftool itself.
- node-exiftool - Alternate exiftool wrapper.
- simple-exiftool - Alternate exiftool wrapper.
License
MIT © Travis Fischer