I'm using a node.js package called exiftool, which basically is an API to a bash script called exiftool. The process behind is async, and i'm having a hard time to figure it out how to wait the async finish before return all.
That's the code:
MAP.files = MAP.scan.map((scan) => {
file = {};
exiftool.metadata(scan, function(error, metadata) {
if (metadata) { return file; }
file.metadata = metadata;
});
return file;
});
So, when i try to access the MAP.files, the result will be several empty object. I understand why, but.. how can i avoid such not desire result?
Thanks.