Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ fs.readFile('./tests/resources/chvrches.jpg', function (err, data) {

```js
var exif = require('exiftool');
// When change the location de exiftool
exif.command('./my-path/My-binary');

exif.metadata('./tests/resources/chvrches.jpg', function (err, metadata) {
if (err)
Expand All @@ -58,7 +60,7 @@ The properties and contents of the metadata dictionary returned by exiftool will
__From a JPG:__

```js
{ exiftoolVersionNumber: 9.58,
[ exiftoolVersionNumber: 9.58,
fileType: 'JPEG',
mimeType: 'image/jpeg',
jfifVersion: 1.01,
Expand All @@ -71,13 +73,13 @@ __From a JPG:__
bitsPerSample: 8,
colorComponents: 3,
yCbCrSubSampling: 'YCbCr4:2:0 (2 2)',
imageSize: '620x413' }
imageSize: '620x413' ]
```

__From a MOV:__

```js
{ exiftoolVersionNumber: 9.58,
[ exiftoolVersionNumber: 9.58,
fileType: 'MOV',
mimeType: 'video/quicktime',
majorBrand: 'Apple QuickTime (.MOV/QT)',
Expand Down Expand Up @@ -172,7 +174,7 @@ __From a MOV:__
userDataDes: 'In theaters 2012',
avgBitrate: '457 kbps',
imageSize: '320x136',
rotation: 0 }
rotation: 0 ]
```

## Filtering metadata
Expand Down
17 changes: 15 additions & 2 deletions lib/exiftool.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
var ChildProcess = require('child_process');
var command = 'exiftool';
/*
var exiftool = require('exiftool');

// When change the command
exiftool('My-New-command');
exiftool.metadata(...)
*/

exports.command = function (c) {
if(typeof c === 'string')
command = c;
};

// Accepts the raw binary content of a file or a path and returns the meta data of the file.
exports.metadata = function (source, tags, doneGettingMetadata) {
Expand All @@ -17,7 +30,7 @@ exports.metadata = function (source, tags, doneGettingMetadata) {
usingBinaryData = true;
}

var exif = ChildProcess.spawn('exiftool', tags);
var exif = ChildProcess.spawn(command || 'exiftool', tags);

//Check for error because of the child process not being found / launched.
exif.on('error', function (err) {
Expand Down Expand Up @@ -84,4 +97,4 @@ exports.metadata = function (source, tags, doneGettingMetadata) {
}

return exif;
};
};