@digabi/exam-engine-core 19.8.8 → 19.8.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ export declare function createFileWithCleanExif(source: string): Promise<string>;
2
+ //# sourceMappingURL=exifDataAndImageHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exifDataAndImageHandler.d.ts","sourceRoot":"","sources":["../../src/utils/exifDataAndImageHandler.ts"],"names":[],"mappings":"AAKA,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAc7E"}
@@ -0,0 +1,61 @@
1
+ import path from 'path';
2
+ import tmp from 'tmp-promise';
3
+ import { readFileSync, writeFileSync } from 'fs';
4
+ import { load, insert, dump, remove, TagValues } from 'piexif-ts';
5
+ export async function createFileWithCleanExif(source) {
6
+ const cacheDirectory = await tmp.dir({ unsafeCleanup: true }).then((d) => d.path);
7
+ const newFileSource = `${cacheDirectory}/${path.parse(source).base}`;
8
+ const imageData = function (src) {
9
+ return readFileSync(src).toString('binary');
10
+ };
11
+ const data = load(imageData(source));
12
+ const cleanExifData = createCleanExif(data);
13
+ const imageBinary = remove(imageData(source));
14
+ const newExifBinary = dump(cleanExifData);
15
+ const newImageBinary = insert(newExifBinary, imageBinary);
16
+ writeFileSync(newFileSource, newImageBinary, { encoding: 'binary' });
17
+ return newFileSource;
18
+ }
19
+ function createCleanExif(exifSource) {
20
+ const newExifData = { ...exifSource };
21
+ if (newExifData && newExifData['0th']) {
22
+ newExifData['0th'][TagValues.ImageIFD.DocumentName] = '';
23
+ newExifData['0th'][TagValues.ImageIFD.ImageDescription] = '';
24
+ newExifData['0th'][TagValues.ImageIFD.Make] = '';
25
+ newExifData['0th'][TagValues.ImageIFD.Model] = '';
26
+ newExifData['0th'][TagValues.ImageIFD.Software] = '';
27
+ newExifData['0th'][TagValues.ImageIFD.DateTime] = '';
28
+ newExifData['0th'][TagValues.ImageIFD.Artist] = '';
29
+ newExifData['0th'][TagValues.ImageIFD.HostComputer] = '';
30
+ newExifData['0th'][TagValues.ImageIFD.Copyright] = '';
31
+ newExifData['0th'][TagValues.ImageIFD.ExposureTime] = [[0]];
32
+ newExifData['0th'][TagValues.ImageIFD.TimeZoneOffset] = [0];
33
+ newExifData['0th'][TagValues.ImageIFD.XPKeywords] = [0];
34
+ newExifData['0th'][TagValues.ImageIFD.XPTitle] = [0];
35
+ newExifData['0th'][TagValues.ImageIFD.XPComment] = [0];
36
+ newExifData['0th'][TagValues.ImageIFD.XPAuthor] = [0];
37
+ newExifData['0th'][TagValues.ImageIFD.XPSubject] = [0];
38
+ newExifData['0th'][TagValues.ImageIFD.LocalizedCameraModel] = [0];
39
+ newExifData['0th'][TagValues.ImageIFD.CameraSerialNumber] = '';
40
+ newExifData['0th'][TagValues.ImageIFD.MakerNoteSafety] = [0];
41
+ newExifData['0th'][TagValues.ImageIFD.OriginalRawFileName] = [0];
42
+ newExifData['0th'][TagValues.ImageIFD.OriginalRawFileData] = '';
43
+ }
44
+ if (newExifData && newExifData.Exif) {
45
+ newExifData.Exif[TagValues.ExifIFD.MakerNote] = '';
46
+ newExifData.Exif[TagValues.ExifIFD.UserComment] = '';
47
+ newExifData.Exif[TagValues.ExifIFD.LensMake] = '';
48
+ newExifData.Exif[TagValues.ExifIFD.LensModel] = '';
49
+ newExifData.Exif[TagValues.ExifIFD.LensSerialNumber] = '';
50
+ newExifData.Exif[TagValues.ExifIFD.LensSpecification] = [[0]];
51
+ newExifData.Exif[TagValues.ExifIFD.CameraOwnerName] = '';
52
+ newExifData.Exif[TagValues.ExifIFD.BodySerialNumber] = '';
53
+ newExifData.Exif[TagValues.ExifIFD.DateTimeOriginal] = '';
54
+ newExifData.Exif[TagValues.ExifIFD.DateTimeDigitized] = '';
55
+ }
56
+ if (newExifData && newExifData.GPS) {
57
+ newExifData.GPS = {};
58
+ }
59
+ return newExifData;
60
+ }
61
+ //# sourceMappingURL=exifDataAndImageHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,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AQ,CAAC,GAAG,EAAE,CAAA;QACjD,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,CAAA;QAClD,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAA;QACzD,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC7D,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,EAAE,CAAA;QACxD,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAA;QACzD,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAA;QACzD,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG,EAAE,CAAA;KAC3D;IACD,IAAI,WAAW,IAAI,WAAW,CAAC,GAAG,EAAE;QAClC,WAAW,CAAC,GAAG,GAAG,EAAE,CAAA;KACrB;IACD,OAAO,WAAW,CAAA;AACpB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digabi/exam-engine-core",
3
- "version": "19.8.8",
3
+ "version": "19.8.9",
4
4
  "main": "dist/main-bundle.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "Matriculation Examination Board, Finland",
@@ -60,5 +60,5 @@
60
60
  "webpack-bundle-analyzer": "^4.1.0",
61
61
  "webpack-cli": "^5.0.2"
62
62
  },
63
- "gitHead": "9cba397d7cc35b576b8e5a06c85bde44992140fd"
63
+ "gitHead": "7922a4e9770d51b46d1a2b197243611dbe25fb5d"
64
64
  }