exiftool icon indicating copy to clipboard operation
exiftool copied to clipboard

can we run exiftool synchronously.

Open supreetssethi opened this issue 8 years ago • 1 comments

Hi there, I am trying to dynamically get file details and i want to store it in db. When i am trying to run exif. it runs asynchronously so i couldn't get the exact mapping of file name and file metadata.

can you please help me out with this.

supreetssethi avatar Jan 16 '18 10:01 supreetssethi

I have the same issue too, although I'm not sure to what extent this is a sync/async issue or an exiftool issue. Any help would be appreciated.

What I'm trying to do is the following. I have a function getExifData which calls exiftool's method to fetch the exif data. I then need the result of that to continue with.

getExifData = async () => {
  const meta = exif.metadata('myfile.mp4', (err, metadata) => {
    if (err) {
       throw err;
       return {};
     } else {
         return metadata;
      }
   });
  return await meta;
}
myFunction = ()  => {
  const exifData = this.getExifData();
  const extension = exifData.category; // This needs the promise from exifData to be resolved
}

Because getExifData needs to be an async function, the second line in myFunction executes before the promise is resolved. I cannot make myFunction async, because the function that calls that would get the same issue.

What should I do here, if this is at all possible with exiftool?

paddotk avatar Sep 29 '19 00:09 paddotk