1.0.1 • Published 4 years ago

exiftool2 v1.0.1

Weekly downloads
15
License
Apache-2.0
Repository
github
Last release
4 years ago

Exiftool2

NPM version NPM downloads Build status Test coverage

Wrapper for efficiently working with exiftool.

I'd also recommend using exiftool-vendored!

Installation

npm install exiftool2 --save

Usage

import { exec, open } from "exiftool2";

// Pass arguments to create an instance of `exiftool` parsing.
// Default arguments: `-q -json`
// Read more: http://linux.die.net/man/1/exiftool
const exif = exec(["-fast", "placeholder.png"]);

// The `exif` result is always an array of exif objects from `exiftool`.
exif.on("exif", data => console.log(data));
exif.on("error", error => console.error(error));

// Supports streaming into `exiftool`.
const exif = exec("-fast", "-");

// Remember you can close the connection early on exif data.
exif.on("exif", data => console.log(data));

// Pipe directly into `exiftool` (E.g. over HTTP).
createReadStream("placeholder.png").pipe(exif);

// Create an instance that defaults to `-stay_open`.
// Identical to `exec`, except for the default arguments.
// Default arguments: `-stay_open True -@ -`
const exif = open(["-fast", "placeholder.png"]);

// Multiple `exif` events will emit in `open` mode.
exif.on("exif", data => console.log(data));

// Push commands to `-execute`. Appends `-q -json` to each `send()` command.
exif.send("placeholder.png");

// You also also stream with `-stay_open`.
// Both `send` and `read` return a promise to resolve with exif data.
exif.read(createReadStream("placeholder.png"));

// Sends `-stay_open False`, causing `exiftool` to close.
exif.close();

License

Apache 2.0