https://github.com/transitive-bullshit/p-exiftool
Wrapper around exiftool for reading metadata from many different file types.
https://github.com/transitive-bullshit/p-exiftool
exiftool metadata metadata-extraction
Last synced: 4 months ago
JSON representation
Wrapper around exiftool for reading metadata from many different file types.
- Host: GitHub
- URL: https://github.com/transitive-bullshit/p-exiftool
- Owner: transitive-bullshit
- Created: 2018-05-03T15:21:10.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-07-11T23:14:26.000Z (almost 6 years ago)
- Last Synced: 2025-11-01T04:08:50.190Z (8 months ago)
- Topics: exiftool, metadata, metadata-extraction
- Language: JavaScript
- Size: 2.79 MB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# p-exiftool
> Wrapper around [exiftool](https://www.sno.phy.queensu.ca/~phil/exiftool/) for reading metadata from many different file types.
[](https://www.npmjs.com/package/p-exiftool) [](https://travis-ci.com/transitive-bullshit/p-exiftool) [](https://standardjs.com)
- supports many different [file types](https://sno.phy.queensu.ca/~phil/exiftool/#supported)
- 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
```bash
brew install exiftool
npm install --save p-exiftool
```
### Ubuntu
```bash
sudo apt-get update
sudo apt-get install libimage-exiftool-perl
npm install --save p-exiftool
```
See more details on [installing exiftool](https://sno.phy.queensu.ca/~phil/exiftool/install.html).
## Usage
```js
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` or `Promise>`
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](https://www.sno.phy.queensu.ca/~phil/exiftool/) - Underlying binary exiftool itself.
- [node-exiftool](https://github.com/nathanpeck/exiftool) - Alternate exiftool wrapper.
- [simple-exiftool](https://github.com/ubaltaci/simple-exiftool) - Alternate exiftool wrapper.
## License
MIT © [Travis Fischer](https://github.com/transitive-bullshit)
Support my OSS work by following me on twitter