Tracking meta source file for EXIF data.
This commit is contained in:
parent
f4535e443b
commit
5b20a538ff
|
@ -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