Tracking meta source file for EXIF data.
This commit is contained in:
parent
07d157604d
commit
e3899362d7
|
@ -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;
|
Loading…
Reference in New Issue