diff --git a/README.md b/README.md index 038a56b..2e32d76 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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, @@ -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)', @@ -172,7 +174,7 @@ __From a MOV:__ userDataDes: 'In theaters 2012', avgBitrate: '457 kbps', imageSize: '320x136', - rotation: 0 } + rotation: 0 ] ``` ## Filtering metadata diff --git a/lib/exiftool.js b/lib/exiftool.js index 366f66d..90ec4d0 100644 --- a/lib/exiftool.js +++ b/lib/exiftool.js @@ -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) { @@ -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) { @@ -84,4 +97,4 @@ exports.metadata = function (source, tags, doneGettingMetadata) { } return exif; -}; +}; \ No newline at end of file