exif-be-gone
Advanced tools
Comparing version
@@ -27,2 +27,3 @@ "use strict"; | ||
var flirMarker = Buffer.from('FLIR', 'utf-8'); | ||
var maxMarkerLength = Math.max(exifMarker.length, xmpMarker.length, flirMarker.length); | ||
var ExifTransformer = /** @class */ (function (_super) { | ||
@@ -63,3 +64,3 @@ __extends(ExifTransformer, _super); | ||
// so defer | ||
if (app1Start + 27 > pendingChunk.length) { | ||
if (app1Start + maxMarkerLength + 4 > pendingChunk.length) { | ||
if (atEnd) { | ||
@@ -76,6 +77,6 @@ this.push(pendingChunk); | ||
else { | ||
var candidateMarker = pendingChunk.slice(app1Start + 4, app1Start + 27); | ||
var candidateMarker = pendingChunk.slice(app1Start + 4, app1Start + maxMarkerLength + 4); | ||
if (exifMarker.compare(candidateMarker, 0, exifMarker.length) === 0 || xmpMarker.compare(candidateMarker, 0, xmpMarker.length) === 0 || flirMarker.compare(candidateMarker, 0, flirMarker.length) === 0) { | ||
// we add 2 to the remainingBytes to account for the app1 marker | ||
this.remainingBytes = pendingChunk.readInt16BE(app1Start + 2) + 2; | ||
this.remainingBytes = pendingChunk.readUInt16BE(app1Start + 2) + 2; | ||
this.push(pendingChunk.slice(0, app1Start)); | ||
@@ -82,0 +83,0 @@ pendingChunk = pendingChunk.slice(app1Start); |
@@ -8,2 +8,4 @@ import { Transform, TransformOptions, TransformCallback } from 'stream' | ||
const maxMarkerLength = Math.max(exifMarker.length, xmpMarker.length, flirMarker.length) | ||
class ExifTransformer extends Transform { | ||
@@ -46,3 +48,3 @@ remainingBytes?: number | ||
// so defer | ||
if (app1Start + 27 > pendingChunk.length) { | ||
if (app1Start + maxMarkerLength + 4 > pendingChunk.length) { | ||
if (atEnd) { | ||
@@ -57,6 +59,6 @@ this.push(pendingChunk) | ||
} else { | ||
const candidateMarker = pendingChunk.slice(app1Start + 4, app1Start + 27) | ||
const candidateMarker = pendingChunk.slice(app1Start + 4, app1Start + maxMarkerLength + 4) | ||
if (exifMarker.compare(candidateMarker, 0, exifMarker.length) === 0 || xmpMarker.compare(candidateMarker, 0, xmpMarker.length) === 0 || flirMarker.compare(candidateMarker, 0, flirMarker.length) === 0) { | ||
// we add 2 to the remainingBytes to account for the app1 marker | ||
this.remainingBytes = pendingChunk.readInt16BE(app1Start + 2) + 2 | ||
this.remainingBytes = pendingChunk.readUInt16BE(app1Start + 2) + 2 | ||
this.push(pendingChunk.slice(0, app1Start)) | ||
@@ -63,0 +65,0 @@ pendingChunk = pendingChunk.slice(app1Start) |
{ | ||
"name": "exif-be-gone", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Remove EXIF data from your image files.", | ||
@@ -12,2 +12,3 @@ "main": "index.js", | ||
"test": "npm run build && mocha -R spec spec/*.spec.js", | ||
"test-samples": "npm run build && ./script/test.sh", | ||
"lint": "standardx *.ts **/*.ts", | ||
@@ -14,0 +15,0 @@ "lintfix": "standardx *.ts **/*.ts --fix" |
# Exif be gone | ||
Stream transformer to remove exif data | ||
Stream transformer to remove data that could be potentially private. | ||
It currently looks for data in the app1 section that is either exif, xmp, or FLIR and removes it from the stream. | ||
## Installation | ||
@@ -19,1 +21,5 @@ | ||
``` | ||
There is also a command-line version that is installed that can be run via: | ||
`$ exif-be-gone [INPUT] [OUTPUT]` |
Sorry, the diff of this file is not supported yet
292
0.69%25
31.58%18565
-84.74%11
-8.33%