exifreader 4.35.0 → 4.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/exif-reader.d.ts CHANGED
@@ -3,8 +3,33 @@
3
3
 
4
4
  export as namespace ExifReader;
5
5
 
6
+ type FileTypeValue =
7
+ | 'tiff'
8
+ | 'jpeg'
9
+ | 'png'
10
+ | 'heic'
11
+ | 'avif'
12
+ | 'webp'
13
+ | 'gif'
14
+ | 'xml';
15
+
16
+ type FileTypeDescription =
17
+ | 'TIFF'
18
+ | 'JPEG'
19
+ | 'PNG'
20
+ | 'HEIC'
21
+ | 'AVIF'
22
+ | 'WebP'
23
+ | 'GIF'
24
+ | 'XML';
25
+
26
+ interface FileTypeTag {
27
+ value: FileTypeValue,
28
+ description: FileTypeDescription
29
+ }
30
+
6
31
  interface FileTags {
7
- 'FileType'?: 'TIFF' | 'JPEG' | 'PNG' | 'HEIC' | 'AVIF' | 'WebP' | 'GIF',
32
+ 'FileType'?: FileTypeTag,
8
33
  'Bits Per Sample'?: NumberFileTag,
9
34
  'Image Height'?: NumberFileTag,
10
35
  'Image Width'?: NumberFileTag,
@@ -309,10 +334,38 @@ interface XmlDomParser {
309
334
  parseFromString(xml: string, mimeType: string): unknown;
310
335
  }
311
336
 
337
+ type TagSelectorWithId = string | number;
338
+ type TagSelectorNameOnly = string;
339
+
340
+ type TagFilterGroupWithId = true | TagSelectorWithId[];
341
+ type TagFilterGroupNameOnly = true | TagSelectorNameOnly[];
342
+
343
+ export type IncludeTagsOptions = {
344
+ exif?: TagFilterGroupWithId,
345
+ iptc?: TagFilterGroupWithId,
346
+ xmp?: TagFilterGroupNameOnly,
347
+ icc?: TagFilterGroupNameOnly,
348
+ photoshop?: TagFilterGroupWithId,
349
+ makerNotes?: TagFilterGroupWithId,
350
+ mpf?: TagFilterGroupWithId,
351
+ file?: TagFilterGroupNameOnly,
352
+ jfif?: TagFilterGroupNameOnly,
353
+ png?: TagFilterGroupNameOnly,
354
+ riff?: TagFilterGroupNameOnly,
355
+ gif?: TagFilterGroupNameOnly,
356
+ gps?: TagFilterGroupNameOnly,
357
+ composite?: TagFilterGroupNameOnly,
358
+ thumbnail?: TagFilterGroupNameOnly,
359
+ };
360
+
361
+ export type ExcludeTagsOptions = IncludeTagsOptions;
362
+
312
363
  type CommonOptions = {
313
364
  includeUnknown?: boolean,
314
365
  computed?: boolean,
315
- domParser?: XmlDomParser
366
+ domParser?: XmlDomParser,
367
+ includeTags?: IncludeTagsOptions,
368
+ excludeTags?: ExcludeTagsOptions,
316
369
  };
317
370
 
318
371
  export function load(data: ArrayBuffer | SharedArrayBuffer | Buffer): Tags;
@@ -582,7 +635,7 @@ interface IccTags {
582
635
  [name: string]: ValueTag;
583
636
  }
584
637
 
585
- export type Tags = XmpTags & IccTags & PngTags & RiffTags & GifTags & PhotoshopTags & CanonTags & PentaxTags & CompositeTags & {
638
+ export type Tags = FileTags & XmpTags & IccTags & PngTags & RiffTags & GifTags & PhotoshopTags & CanonTags & PentaxTags & CompositeTags & {
586
639
  'Thumbnail'?: ThumbnailTags;
587
640
  'Images'?: MPFImageTags[],
588
641
  } & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exifreader",
3
- "version": "4.35.0",
3
+ "version": "4.36.1",
4
4
  "description": "Library that parses Exif metadata in images.",
5
5
  "author": "Mattias Wallander <mattias@wallander.eu>",
6
6
  "repository": {
@@ -57,22 +57,24 @@
57
57
  "lint": "eslint .",
58
58
  "start": "cross-env NODE_ENV=development webpack serve",
59
59
  "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive \"test/unit/\"",
60
+ "test:integration": "cross-env BABEL_ENV=test mocha --require @babel/register \"test/integration/**/*-spec.js\"",
61
+ "test:integration:update": "node test/integration/update.js",
60
62
  "test:build": "mocha test/build/test.js",
61
63
  "test:build:custom": "mocha --bail test/build/test-custom.js",
62
64
  "test:build:update": "node test/build/update.js",
63
65
  "test:e2e": "cypress run",
64
66
  "test:types": "tsc --noEmit --project test/types",
65
- "test:all": "npm-run-all lint test:types coverage test:e2e test:build test:build:custom",
67
+ "test:all": "npm-run-all lint test:types coverage test:e2e test:integration test:build test:build:custom",
66
68
  "pre-commit": "npm-run-all lint test:types coverage test:build",
67
69
  "postinstall": "node bin/build.js --only-with-config",
68
70
  "prepare": "husky"
69
71
  },
70
72
  "nyc": {
71
73
  "check-coverage": true,
72
- "statements": 93,
73
- "branches": 87,
74
+ "statements": 92,
75
+ "branches": 86,
74
76
  "functions": 97,
75
- "lines": 93,
77
+ "lines": 92,
76
78
  "reporter": [
77
79
  "lcov",
78
80
  "text"
package/src/canon-tags.js CHANGED
@@ -20,8 +20,26 @@ export default {
20
20
  SHOT_INFO_AUTO_ROTATE
21
21
  };
22
22
 
23
- function read(dataView, tiffHeaderOffset, offset, byteOrder, includeUnknown, computed = false) {
24
- let tags = readIfd(dataView, IFD_TYPE_CANON, tiffHeaderOffset, tiffHeaderOffset + offset, byteOrder, includeUnknown, computed);
23
+ function read(
24
+ dataView,
25
+ tiffHeaderOffset,
26
+ offset,
27
+ byteOrder,
28
+ includeUnknown,
29
+ computed = false,
30
+ tagFilter = undefined
31
+ ) {
32
+ let tags = readIfd(
33
+ dataView,
34
+ IFD_TYPE_CANON,
35
+ tiffHeaderOffset,
36
+ tiffHeaderOffset + offset,
37
+ byteOrder,
38
+ includeUnknown,
39
+ computed,
40
+ tagFilter,
41
+ 'makerNotes'
42
+ );
25
43
 
26
44
  if (tags['ShotInfo']) {
27
45
  tags = objectAssign({}, tags, parseShotInfo(tags['ShotInfo'].value));