I am trying to get the tag metadata from a JPG image using NodeJS and the exiftool. This is the first time I am using NodeJS. This is what I tried: I installed NodeJS for windows. I have an image with the name t.jpg and in the same directory I have a js file called run.js
This is the run.js file
var exif = require('exiftool');
var fs = require('fs');
fs.readFile('t.jpg', function (err, data) {
if (err) {
console.log(err);
} else {
exif.metadata(data, function (err, metadata) {
if(err)
console.log(err);
else
console.log(metadata);
});
}
});
I then opened a command line window and typed the following:
I assumed I needed to add whatever was required in the code
npm install exiftool
npm install fs
node run.js
I then got the following error:
> node run.js
events.js:160
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at exports._errnoException (util.js:1026:11)
at Socket._writeGeneric (net.js:710:26)
at Socket._write (net.js:729:8)
at doWrite (_stream_writable.js:333:12)
at writeOrBuffer (_stream_writable.js:319:5)
at Socket.Writable.write (_stream_writable.js:246:11)
at Socket.write (net.js:656:40)
at Object.exports.metadata (C:\Users\chris\Dropbox\Werk\nodejs\no
at C:\Users\chris\Dropbox\Werk\nodejs\run.js:7:10
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3)
Any idea what am I doing wrong? What can I do to get what I want?
See comments -> exiftool
must be installed in system PATH. To easily test this, try running exiftool
from command line (cmd or powershell).