Merge branch 'feature-remove-exif' of https://github.com/davejm/CyberChef into davejm-feature-remove-exif

This commit is contained in:
n1474335 2017-06-08 10:56:06 +00:00
commit e92775eec2
5 changed files with 239 additions and 0 deletions

View file

@ -1,4 +1,5 @@
import * as ExifParser from "exif-parser";
import removeEXIF from "../lib/remove-exif.js";
import Utils from "../Utils.js";
import FileType from "./FileType.js";
@ -43,6 +44,28 @@ const Image = {
}
},
/**
* Remove EXIF operation.
*
* Removes EXIF data from a byteArray, representing a JPG.
*
* @author David Moodie [davidmoodie12@gmail.com]
* @param {byteArray} input
* @param {Object[]} args
* @returns {string}
*/
removeEXIF(input, args) {
// Do nothing if input is empty
if (input.length === 0) return input;
try {
return removeEXIF(input);
} catch (err) {
// Simply return input if no EXIF data is found
if (err === "Exif not found.") return input;
throw "Could not remove EXIF data from image: " + err;
}
},
/**
* @constant