Tracking meta source file for EXIF data.

This commit is contained in:
DebaucheryLibrarian 2024-09-11 05:16:54 +02:00
parent 07d157604d
commit e3899362d7
1 changed files with 24 additions and 0 deletions

24
src/save/meta.js Normal file
View File

@ -0,0 +1,24 @@
'use strict';
const exiftool = require('node-exiftool');
const exiftoolBin = require('dist-exiftool');
function saveMeta(filepath, meta, globalExifTool) {
const ep = globalExifTool || new exiftool.ExiftoolProcess(exiftoolBin);
return Promise.resolve().then(() => {
if(!globalExifTool) {
return ep.open();
}
}).then(() => {
return ep.writeMetadata(filepath, meta, ['overwrite_original']);
}).then(() => {
console.log('\x1b[36m%s\x1b[0m', `Wrote metadata to '${filepath}'`);
}).then(() => {
if(!globalExifTool) {
return ep.close();
}
});
};
module.exports = saveMeta;