exiftool-vendored 15.12.0 → 16.1.0

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/CHANGELOG.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Providing the flexibility to reversion the API or UPDATE version slots as
6
6
  features or bugfixes arise and using ExifTool's version number is at odds with
7
- eachother, so this library follows [Semver](https://semver.org/), and the
7
+ each other, so this library follows [Semver](https://semver.org/), and the
8
8
  vendored versions of ExifTool match the version they vendor.
9
9
 
10
10
  ### The `MAJOR` or `API` version is incremented for
@@ -25,6 +25,84 @@ vendored versions of ExifTool match the version they vendor.
25
25
 
26
26
  ## Version history
27
27
 
28
+ ### v16.1.0
29
+
30
+ - ✨ Updated dependencies, including batch-cluster
31
+ [v10.4.0](https://github.com/photostructure/batch-cluster.js/blob/main/CHANGELOG.md#v1040)).
32
+
33
+ This new version will detect when tasks are rejected (due to parsing issues or
34
+ any other reason), and in that case, the child `exiftool` process will be
35
+ verified to be "healthy" before being put back into the service pool.
36
+
37
+ ### v16.0.0
38
+
39
+ - 💔/🐞 Timezone extraction has been adjusted: if there is a GPS location, we'll
40
+ prefer that `tzlookup` as the authoritative timezone offset. If there isn't
41
+ GPS lat/lon, we'll use `Timezone`, `OffsetTime`, or `TimeZoneOffset`. If those
42
+ are missing, we'll infer the offset from UTC offsets.
43
+
44
+ Prior builds would defer to the offset in `Timezone`, `OffsetTime`, or
45
+ `TimeZoneOffset`, but GPS is more reliable, and results in a proper time zone
46
+ (like `America/Los_Angeles`). Zone names work correctly even when times are
47
+ adjusted across daylight savings offset boundaries.
48
+
49
+ - 💔/🐞 Timezone application is now has been improved: if a timezone can be
50
+ extracted for a given file, `readTags` will now make all `ExifDateTime`
51
+ entries match that timezone. The timestamps should refer to the same
52
+ timestamp/seconds-from-common-epoch, but "local time" may be different as
53
+ we've adjusted the timezone accordingly.
54
+
55
+ Metadata sometimes includes a timezone offset, and sometimes it doesn't, and
56
+ it's all pretty inconsistent, but worse, prior versions would sometimes
57
+ inherit the current system timezone for an arbitrary subset of tags. This
58
+ version should remove the system timezone "leaking" into your metadata values.
59
+
60
+ As an example, if you took a photo with GPS information from Rome (CET,
61
+ UTC+1), and your computer is in California with `TZ=America/Los_Angeles`,
62
+ prior versions could return `CreateDate: 2022-02-02 02:02:22-07:00`. This
63
+ version will translate that time into `CreateDate: 2022-02-02 11:02:22+01:00`.
64
+
65
+ Note that this fix results in `readTags` rendering different `ExifDateTime`
66
+ values from prior versions, so I bumped the major version to highlight this
67
+ change.
68
+
69
+ - 💔 `Tags` is automatically generated by `mktags`, which now has a set of
70
+ "required" tags with type and group metadata to ensure a core set of tags
71
+ don't disappear or change types.
72
+
73
+ As a reminder, the `Tags` interface is only a subset of fields returned, due
74
+ to TypeScript limitations. `readTags` still returns all values that ExifTool
75
+ provides.
76
+
77
+ - 🐞 Fixed a bunch of broken API links in the README due to `typedoc` changing
78
+ URLs. Harumph.
79
+ - 🐞 Prior versions of `ExifDateTime.parseISO` would accept just time or date
80
+ strings.
81
+ - 🐞/📦 `TimeStamp` tags may now be properly parsed as `ExifDateTime`.
82
+ - 📦 Added performance section to the README.
83
+
84
+ - 📦 Timezone offset formatting changed slightly: the hour offset is no longer
85
+ zero-padded, which better matches the Luxon implementation we use internally.
86
+
87
+ - 📦 `ExifDateTime` caches the result of `toDateTime` now, which may save a
88
+ couple extra objects fed to the GC.
89
+
90
+ - 📦 Updated dependencies, including batch-cluster
91
+ [v10.3.2](https://github.com/photostructure/batch-cluster.js/blob/main/CHANGELOG.md#v1032)),
92
+ which fixed several race conditions and added several process performance
93
+ improvements including support for zero-wait multi-process launches.
94
+
95
+ ### v15.12.1
96
+
97
+ - 📦 Updated dependencies (batch-cluster
98
+ [v10.3.0](https://github.com/photostructure/batch-cluster.js/blob/main/CHANGELOG.md#v1030)),
99
+ including more pessimistic defaults for `streamFlushMillis` and new
100
+ `noTaskData` event.
101
+
102
+ - 📦 Exported type signatures, `AdditionalWriteTags`, `ExpandedDateTags`,
103
+ `Maybe`, `Omit`, and `Struct` to improve `typedoc`-generated documentation.
104
+ Rebuilt docs.
105
+
28
106
  ### v15.12.0
29
107
 
30
108
  - 📦 We now verify external `exiftool`s are healthy with a `-ver` ping every 30 seconds.
package/README.md CHANGED
@@ -21,19 +21,16 @@
21
21
 
22
22
  1. Support for
23
23
 
24
- - [reading tags](https://photostructure.github.io/exiftool-vendored.js/classes/exiftool.html#read)
25
- - extracting embedded binaries, like [thumbnail](https://photostructure.github.io/exiftool-vendored.js/classes/exiftool.html#extractthumbnail) and [preview](https://photostructure.github.io/exiftool-vendored.js/classes/exiftool.html#extractpreview) images
26
- - [writing tags](https://photostructure.github.io/exiftool-vendored.js/classes/exiftool.html#write)
27
- - [rescuing metadata](https://photostructure.github.io/exiftool-vendored.js/classes/exiftool.html#rewritealltags)
24
+ - [reading tags](https://photostructure.github.io/exiftool-vendored.js/classes/ExifTool.html#read)
25
+ - extracting embedded binaries, like [thumbnail](https://photostructure.github.io/exiftool-vendored.js/classes/ExifTool.html#extractThumbnail) and [preview](https://photostructure.github.io/exiftool-vendored.js/classes/ExifTool.html#extractPreview) images
26
+ - [writing tags](https://photostructure.github.io/exiftool-vendored.js/classes/ExifTool.html#write)
27
+ - [rescuing metadata](https://photostructure.github.io/exiftool-vendored.js/classes/ExifTool.html#rewriteAllTags)
28
28
 
29
29
  1. **[Robust type definitions](#tags)** of the top 99.5% tags used by over 6,000
30
- different camera makes and models (see an [example](interfaces/exiftags.html))
31
-
32
- 1. **Auditable ExifTool source code** (the vendored code is
33
- [checksum verified](http://owl.phy.queensu.ca/~phil/exiftool/checksums.txt))
30
+ different camera makes and models (see an [example](https://photostructure.github.io/exiftool-vendored.js/interfaces/EXIFTags.html))
34
31
 
35
32
  1. **Automated updates** to ExifTool ([as new versions come out
36
- monthly](http://www.sno.phy.queensu.ca/~phil/exiftool/history.html))
33
+ monthly](https://exiftool.org/history.html))
37
34
 
38
35
  1. **Robust test coverage**, performed with on [macOS, Linux, and
39
36
  Windows](https://github.com/photostructure/exiftool-vendored.js/actions?query=workflow%3A%22Node.js+CI%22)
@@ -59,7 +56,7 @@ If you're installing on a minimal Linux distribution, like
59
56
  ## Upgrading
60
57
 
61
58
  See the
62
- [CHANGELOG](https://github.com/mceachen/exiftool-vendored.js/blob/main/CHANGELOG.md)
59
+ [CHANGELOG](https://github.com/photostructure/exiftool-vendored.js/blob/main/CHANGELOG.md)
63
60
  for breaking changes since you last updated.
64
61
 
65
62
  ### Major version bumps
@@ -96,7 +93,7 @@ exiftool
96
93
  ```
97
94
 
98
95
  If the default [ExifTool constructor
99
- parameters](https://photostructure.github.io/exiftool-vendored.js/interfaces/exiftooloptions.html)
96
+ parameters](https://photostructure.github.io/exiftool-vendored.js/interfaces/ExifToolOptions.html)
100
97
  wont' work for you, it's just a class that takes an options hash:
101
98
 
102
99
  ```js
@@ -110,7 +107,7 @@ Remember to `.end()` whichever singleton you use.
110
107
 
111
108
  ### General API
112
109
 
113
- `ExifTool.read()` returns a Promise to a [Tags](https://photostructure.github.io/exiftool-vendored.js/interfaces/tags.html) instance. Note
110
+ `ExifTool.read()` returns a Promise to a [Tags](https://photostructure.github.io/exiftool-vendored.js/interfaces/Tags.html) instance. Note
114
111
  that errors may be returned either by rejecting the promise, or for less
115
112
  severe problems, via the `errors` field.
116
113
 
@@ -123,9 +120,9 @@ ExifTool knows how to extract _several thousand_ different tag fields.
123
120
 
124
121
  Unfortunately, TypeScript crashes with `error TS2590: Expression produces a union type that is too complex to represent` if the `Tags` interface was comprehensive.
125
122
 
126
- Instead, we build a corpus of "commonly seen" tags from over 5,000 different
123
+ Instead, we build a corpus of "commonly seen" tags from over 10,000 different
127
124
  digital camera makes and models, many from the [ExifTool metadata
128
- repository](https://exiftool.org/sample_images.html).
125
+ repository](https://exiftool.org/sample_images.html) and <raw.pixls.us>.
129
126
 
130
127
  Here are some example fields:
131
128
 
@@ -156,33 +153,14 @@ Nikon, Canon, Sony, and Apple devices).
156
153
  Just because a field is missing from the Tags interface **does not mean the
157
154
  field doesn't exist in the returned object**. This library doesn't exclude
158
155
  unknown fields, in other words. It's up to you and your code to look for other
159
- fields you expect, and cast to a more relevant interface.
160
-
161
- ### Errors and Warnings
162
-
163
- ExifTool has a pretty exhaustive set of error checking, and many "errors" are
164
- actually non-fatal warnings about invalid tag structures that seem to be
165
- regularly found in otherwise-not-corrupt images.
166
-
167
- If we rejected every `read` or `write` when any error happened, this would
168
- prevent reading and/or writing to otherwise-ok files. To "demote" errors to be
169
- warnings that don't reject the underlying task, you can provide either a
170
- [`minorErrorsRegExp`](interfaces/exiftooloptions.html#minorerrorsregexp), or an
171
- implementation of
172
- [`rejectTaskOnStderr`](interfaces/exiftooloptions.html#rejecttaskonstderr).
173
- Either of these parameters are provided to the `ExifTool` constructor.
156
+ fields you expect and cast to a more relevant interface.
174
157
 
175
158
  ### Logging and events
176
159
 
177
160
  To enable trace, debug, info, warning, or error logging from this library and
178
- the underlying `batch-cluster` library,
179
- use[`setLogger`](globals.html#setlogger). Example
180
- code can be found
181
- [here](https://github.com/photostructure/batch-cluster.js/blob/main/src/_chai.spec.ts#L20).
161
+ the underlying `batch-cluster` library, provide a [Logger](https://photostructure.github.io/batch-cluster.js/interfaces/Logger.html) instance to the `ExifTool` constructor options.
182
162
 
183
- ExifTool instances emits events for "startError", "taskError", "endError",
184
- "beforeEnd", and "end" that you can register listeners for, using
185
- [on](https://batch-cluster.js.org/classes/batchcluster.html#on).
163
+ ExifTool instances emits [many lifecycle and error events](https://photostructure.github.io/batch-cluster.js/interfaces/BatchClusterEvents.html#beforeEnd) via `batch-cluster`.
186
164
 
187
165
  ### Reading tags
188
166
 
@@ -229,14 +207,14 @@ exiftool.extractBinaryTag("tagname", "path/to/file.exf", "path/to/dest.bin")
229
207
 
230
208
  ### Writing tags
231
209
 
232
- Note that only a portion of tags are writable. Refer to [the
233
- documentation](https://sno.phy.queensu.ca/~phil/exiftool/TagNames/index.html)
210
+ Note that only a portion of tags is writable. Refer to [the
211
+ documentation](https://exiftool.org/TagNames/index.html)
234
212
  and look under the "Writable" column.
235
213
 
236
214
  If you apply malformed values or ask to write to tags that aren't
237
215
  supported, the returned `Promise` will be rejected.
238
216
 
239
- Only string and numeric primitive are supported as values to the object.
217
+ Only string and numeric primitives are supported as values to the object.
240
218
 
241
219
  To write a comment to the given file so it shows up in the Windows Explorer
242
220
  Properties panel:
@@ -246,7 +224,7 @@ exiftool.write("path/to/file.jpg", { XPComment: "this is a test comment" })
246
224
  ```
247
225
 
248
226
  To change the DateTimeOriginal, CreateDate and ModifyDate tags (using the
249
- [AllDates](https://sno.phy.queensu.ca/~phil/exiftool/TagNames/Shortcuts.html)
227
+ [AllDates](https://exiftool.org/TagNames/Shortcuts.html)
250
228
  shortcut) to 4:56pm UTC on February 6, 2016:
251
229
 
252
230
  ```js
@@ -268,7 +246,7 @@ To delete a tag, use `null` as the value.
268
246
  exiftool.write("path/to/file.jpg", { UserComment: null })
269
247
  ```
270
248
 
271
- The above example removes any value associated to the `UserComment` tag.
249
+ The above example removes any value associated with the `UserComment` tag.
272
250
 
273
251
  ### Always Beware: Timezones
274
252
 
@@ -282,11 +260,11 @@ section about [Dates](#dates) below for more information.
282
260
 
283
261
  ### Rewriting tags
284
262
 
285
- You may find that some of your images have corrupt metadata, and that writing
263
+ You may find that some of your images have corrupt metadata and that writing
286
264
  new dates, or editing the rotation information, for example, fails. ExifTool can
287
265
  try to repair these images by rewriting all the metadata into a new file, along
288
266
  with the original image content. See the
289
- [documentation](http://owl.phy.queensu.ca/~phil/exiftool/faq.html#Q20) for more
267
+ [documentation](https://exiftool.org/faq.html#Q20) for more
290
268
  details about this functionality.
291
269
 
292
270
  `rewriteAllTags` returns a void Promise that will be rejected if there are any
@@ -301,10 +279,10 @@ exiftool.rewriteAllTags("problematic.jpg", "rewritten.jpg")
301
279
  ExifTool has an [extensive user configuration system](http://owl.phy.queensu.ca/~phil/exiftool/config.html). There are several ways to use one:
302
280
 
303
281
  1. Place your [user configuration
304
- file](http://owl.phy.queensu.ca/~phil/exiftool/config.html) in your `HOME`
282
+ file](https://exiftool.org/config.html) in your `HOME`
305
283
  directory
306
284
  1. Set the `EXIFTOOL_HOME` environment variable to the fully-qualified path that
307
- contains your user config.
285
+ contains your user configuration.
308
286
  1. Specify the in the ExifTool constructor options:
309
287
 
310
288
  ```js
@@ -316,7 +294,7 @@ new ExifTool({ exiftoolEnv: { EXIFTOOL_HOME: resolve("path", "to", "config", "di
316
294
  The default `BatchClusterOptions.cleanupChildProcs` value of `true` means that BatchCluster, which is used to manage child `exiftool` processes, will try to use `ps` to ensure Node's view of process state are correct, and that errant
317
295
  processes are cleaned up.
318
296
 
319
- If you run this in a docker image based off Alpine or Debian Slim, **this won't work properly unless you install the `procps` package.**
297
+ If you run this in a docker image based on Alpine or Debian Slim, **this won't work properly unless you install the `procps` package.**
320
298
 
321
299
  [See `batch-cluster` for details.](https://github.com/photostructure/batch-cluster.js/issues/13)
322
300
 
@@ -329,7 +307,7 @@ exiting due to the way Node.js streams
329
307
  work](https://github.com/photostructure/exiftool-vendored.js/issues/106).
330
308
 
331
309
  You must explicitly call `.end()` on any used instance of `ExifTool` for `node`
332
- to exit gracefully.
310
+ to exit gracefully.
333
311
 
334
312
  This call cannot be in a `process.on("exit")` hook, as the `stdio` streams
335
313
  attached to the child process cannot be `unref`'ed. (If there's a solution to
@@ -356,9 +334,9 @@ Images and videos rarely specify a time zone in their dates. If all your files
356
334
  were captured in your current time zone, defaulting to the local time zone is a
357
335
  safe assumption, but if you have files that were captured in different parts of
358
336
  the world, **this assumption will not be correct**. Parsing the same file in
359
- different parts of the world results in a different times for the same file.
337
+ different parts of the world result in different times for the same file.
360
338
 
361
- Prior to version 7, heuristic 1 and 3 was applied.
339
+ Prior to version 7, heuristic 1 and 3 were applied.
362
340
 
363
341
  As of version 7.0.0, `exiftool-vendored` uses the following heuristics. The
364
342
  highest-priority heuristic to return a value will be used as the timezone offset
@@ -366,7 +344,7 @@ for all datetime tags that don't already have a specified timezone.
366
344
 
367
345
  ### Heuristic 1: explicit metadata
368
346
 
369
- If the [EXIF](https://sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html)
347
+ If the [EXIF](https://exiftool.org/TagNames/EXIF.html)
370
348
  `TimeZoneOffset` tag is present it will be applied as per the spec to
371
349
  `DateTimeOriginal`, and if there are two values, the `ModifyDate` tag as well.
372
350
  `OffsetTime`, `OffsetTimeOriginal`, and `OffsetTimeDigitized` are also
@@ -386,14 +364,14 @@ Deltas of > 14 hours are considered invalid.
386
364
 
387
365
  ### ExifDate and ExifDateTime
388
366
 
389
- Because datetimes have this optionally-set timezone, and some tags only specify
367
+ Because date-times have this optionally-set timezone, and some tags only specify
390
368
  the date, this library returns classes that encode the date, the time of day, or
391
369
  both, **with an optional timezone and an optional tzoffset**: `ExifDateTime` and
392
370
  `ExifTime`. It's up to you, then, to determine what's correct for your
393
371
  situation.
394
372
 
395
373
  Note also that some smartphones record timestamps with microsecond precision
396
- (not just millis!), and both `ExifDateTime` and `ExifTime` have floating point
374
+ (not just milliseconds!), and both `ExifDateTime` and `ExifTime` have floating point
397
375
  milliseconds.
398
376
 
399
377
  ## Tags
@@ -410,12 +388,12 @@ camera make and model images, in large part sourced from the ExifTool site.
410
388
  that your IDE can autocomplete.
411
389
 
412
390
  Tags marked with "★★★★", like
413
- [MIMEType](https://photostructure.github.io/exiftool-vendored.js/interfaces/tags.html#mimetype),
391
+ [MIMEType](https://photostructure.github.io/exiftool-vendored.js/interfaces/FileTags.html#MIMEType),
414
392
  should be found in most files. Of the several thousand metadata tags, realize
415
- less than 50 are found generally. You'll need to do your own research to
393
+ less than 50 are found generally. You'll need to do your research to
416
394
  determine which tags are valid for your uses.
417
395
 
418
- Note that if parsing fails (for, example, a datetime string), the raw string
396
+ Note that if parsing fails (for, example, a date-time string), the raw string
419
397
  will be returned. Consuming code should verify both existence and type as
420
398
  reasonable for safety.
421
399
 
@@ -439,28 +417,32 @@ const tags2: Tags = parseJSON(str) as Tags
439
417
 
440
418
  ## Performance
441
419
 
442
- The `npm run mktags` target reads all tags found in a batch of sample images and
443
- parses the results.
420
+ The default [exiftool]() singleton is intentionally throttled. If full system
421
+ utilization is acceptable:
444
422
 
445
- Using `exiftool-vendored`:
423
+ 1. set
424
+ [`maxProcs`](https://photostructure.github.io/batch-cluster.js/classes/BatchClusterOptions.html#maxProcs)
425
+ higher
446
426
 
447
- ```sh
448
- Read 2236 unique tags from 3011 files.
449
- Parsing took 16s (5.4ms / file) # windows 10, core i7, maxProcs 4
450
- Parsing took 27s (9.0ms / file) # ubuntu 18.04, core i3, maxProcs 1
451
- Parsing took 13s (4.2ms / file) # ubuntu 18.04, core i3, maxProcs 4
427
+ 2. consider setting
428
+ [`minDelayBetweenSpawnMillis`](https://photostructure.github.io/batch-cluster.js/classes/BatchClusterOptions.html#minDelayBetweenSpawnMillis)
429
+ to 0
452
430
 
453
- # September 2020 update with > 2x more files and faster CPU:
454
- Read 3100 unique tags from 8028 files.
455
- Parsing took 16s (2.0ms / file) # ubuntu 20.04, AMD Ryzen 9 3900X, maxProcs 24
456
- ```
431
+ 3. On a performant linux box, a smaller value of `streamFlushMillis` may work as
432
+ well: if you see [`noTaskData`
433
+ events](https://photostructure.github.io/batch-cluster.js/interfaces/BatchClusterEvents.html#noTaskData),
434
+ you need to bump the value up.
457
435
 
458
- Using the `exiftool` npm package takes 7-10x longer, and doesn't work on Windows.
436
+ ## Benchmarking
459
437
 
460
- ```sh
461
- Reading 3011 files...
462
- Parsing took 86s (28.4ms / file) # ubuntu, core i3
463
- ```
438
+ The `yarn mktags ../path/to/examples` target reads all tags found in a directory
439
+ hierarchy of sample images and videos, and parses the results.
440
+
441
+ `exiftool-vendored` v16.0.0 on a 2019 AMD Ryzen 3900X running Ubuntu 20.04 on an
442
+ SSD can process 20+ files per second, per thread, or 500+ files per second
443
+ utilizing all CPU threads.
444
+
445
+ It can read, parse,
464
446
 
465
447
  ### Batch mode
466
448
 
@@ -1,9 +1,10 @@
1
- import { DateTime, ToISOTimeOptions } from "luxon";
1
+ import { DateTime, ToISOTimeOptions, Zone, ZoneOptions } from "luxon";
2
2
  import { Maybe } from "./Maybe";
3
3
  /**
4
4
  * Encodes an ExifDateTime with an optional tz offset in minutes.
5
5
  */
6
6
  export declare class ExifDateTime {
7
+ #private;
7
8
  readonly year: number;
8
9
  readonly month: number;
9
10
  readonly day: number;
@@ -14,7 +15,7 @@ export declare class ExifDateTime {
14
15
  readonly tzoffsetMinutes?: number | undefined;
15
16
  readonly rawValue?: string | undefined;
16
17
  readonly zoneName?: string | undefined;
17
- static fromISO(iso: string, zone?: Maybe<string>, rawValue?: string): Maybe<ExifDateTime>;
18
+ static fromISO(iso: string, zone?: Maybe<string>): Maybe<ExifDateTime>;
18
19
  /**
19
20
  * Try to parse a date-time string from EXIF. If there is not both a date and
20
21
  * a time component, returns `undefined`.
@@ -33,7 +34,9 @@ export declare class ExifDateTime {
33
34
  get millis(): number | undefined;
34
35
  get hasZone(): boolean;
35
36
  get zone(): Maybe<string>;
37
+ setZone(zone?: string | Zone, opts?: ZoneOptions): ExifDateTime;
36
38
  toDateTime(): DateTime;
39
+ toEpochSeconds(): number;
37
40
  toDate(): Date;
38
41
  toISOString(options?: ToISOTimeOptions): Maybe<string>;
39
42
  toExifString(): string;
@@ -1,4 +1,16 @@
1
1
  "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
+ if (kind === "m") throw new TypeError("Private method is not writable");
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
+ };
13
+ var _ExifDateTime_dt;
2
14
  Object.defineProperty(exports, "__esModule", { value: true });
3
15
  exports.ExifDateTime = void 0;
4
16
  const luxon_1 = require("luxon");
@@ -21,14 +33,24 @@ class ExifDateTime {
21
33
  this.tzoffsetMinutes = tzoffsetMinutes;
22
34
  this.rawValue = rawValue;
23
35
  this.zoneName = zoneName;
36
+ _ExifDateTime_dt.set(this, void 0);
24
37
  }
25
- static fromISO(iso, zone, rawValue) {
38
+ static fromISO(iso, zone) {
26
39
  if ((0, String_1.blank)(iso) || null != iso.match(/^\d+$/))
27
40
  return undefined;
28
- return this.fromDateTime(luxon_1.DateTime.fromISO(iso, {
29
- setZone: true,
30
- zone: zone !== null && zone !== void 0 ? zone : Timezones_1.UnsetZone,
31
- }), rawValue !== null && rawValue !== void 0 ? rawValue : iso);
41
+ // Unfortunately, DateTime.fromISO() is happy to parse a date with no time,
42
+ // so we have to do this ourselves:
43
+ return this.fromPatterns(iso, [
44
+ // if it specifies a zone, use it:
45
+ { fmt: "y-M-d'T'H:m:s.uZZ" },
46
+ { fmt: "y-M-d'T'H:m:sZZ" },
47
+ // if it specifies UTC, use it:
48
+ { fmt: "y-M-d'T'H:m:s.u'Z'", zone: "utc" },
49
+ { fmt: "y-M-d'T'H:m:s'Z'", zone: "utc" },
50
+ // Otherwise use the default zone:
51
+ { fmt: "y-M-d'T'H:m:s.u", zone },
52
+ { fmt: "y-M-d'T'H:m:s", zone },
53
+ ]);
32
54
  }
33
55
  /**
34
56
  * Try to parse a date-time string from EXIF. If there is not both a date and
@@ -67,9 +89,10 @@ class ExifDateTime {
67
89
  }), (dt) => this.fromDateTime(dt, s))));
68
90
  }
69
91
  static fromExifStrict(text, zone) {
92
+ var _a;
70
93
  if ((0, String_1.blank)(text))
71
94
  return undefined;
72
- return this.fromPatterns(text, [
95
+ return ((_a = this.fromPatterns(text, [
73
96
  // if it specifies a zone, use it:
74
97
  { fmt: "y:M:d H:m:s.uZZ" },
75
98
  { fmt: "y:M:d H:m:sZZ" },
@@ -80,16 +103,7 @@ class ExifDateTime {
80
103
  { fmt: "y:M:d H:m:s.u", zone },
81
104
  { fmt: "y:M:d H:m:s", zone },
82
105
  // Not found yet? Maybe it's in ISO format? See https://github.com/photostructure/exiftool-vendored.js/issues/71
83
- // if it specifies a zone, use it:
84
- { fmt: "y-M-d'T'H:m:s.uZZ" },
85
- { fmt: "y-M-d'T'H:m:sZZ" },
86
- // if it specifies UTC, use it:
87
- { fmt: "y-M-d'T'H:m:s.u'Z'", zone: "utc" },
88
- { fmt: "y-M-d'T'H:m:s'Z'", zone: "utc" },
89
- // Otherwise use the default zone:
90
- { fmt: "y-M-d'T'H:m:s.u", zone },
91
- { fmt: "y-M-d'T'H:m:s", zone },
92
- ]);
106
+ ])) !== null && _a !== void 0 ? _a : this.fromISO(text, zone));
93
107
  }
94
108
  static fromExifLoose(text, defaultZone) {
95
109
  if ((0, String_1.blank)(text))
@@ -127,8 +141,21 @@ class ExifDateTime {
127
141
  var _a;
128
142
  return (_a = this.zoneName) !== null && _a !== void 0 ? _a : (0, Timezones_1.offsetMinutesToZoneName)(this.tzoffsetMinutes);
129
143
  }
144
+ setZone(zone, opts) {
145
+ // This is a bit tricky... We want to keep the local time and just _say_ it was in the zone of the image **if we don't already have a zone.**
146
+ // If we _do_ have a zone, assume it was already converted by ExifTool into (probably the system) timezone, which means _don't_ keepLocalTime.
147
+ const result = ExifDateTime.fromDateTime(this.toDateTime().setZone(zone, {
148
+ keepLocalTime: !this.hasZone,
149
+ ...opts,
150
+ }), this.rawValue);
151
+ // We know this will be defined: this is valid, so changing the zone will
152
+ // also be valid.
153
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
154
+ return result;
155
+ }
130
156
  toDateTime() {
131
- return luxon_1.DateTime.fromObject({
157
+ var _a;
158
+ return (__classPrivateFieldSet(this, _ExifDateTime_dt, (_a = __classPrivateFieldGet(this, _ExifDateTime_dt, "f")) !== null && _a !== void 0 ? _a : luxon_1.DateTime.fromObject({
132
159
  year: this.year,
133
160
  month: this.month,
134
161
  day: this.day,
@@ -138,7 +165,10 @@ class ExifDateTime {
138
165
  millisecond: this.millisecond,
139
166
  }, {
140
167
  zone: this.zone,
141
- });
168
+ }), "f"));
169
+ }
170
+ toEpochSeconds() {
171
+ return this.toDateTime().toUnixInteger();
142
172
  }
143
173
  toDate() {
144
174
  return this.toDateTime().toJSDate();
@@ -179,4 +209,5 @@ class ExifDateTime {
179
209
  }
180
210
  }
181
211
  exports.ExifDateTime = ExifDateTime;
212
+ _ExifDateTime_dt = new WeakMap();
182
213
  //# sourceMappingURL=ExifDateTime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExifDateTime.js","sourceRoot":"","sources":["../src/ExifDateTime.ts"],"names":[],"mappings":";;;AAAA,iCAAwD;AACxD,yCAA2C;AAC3C,mCAAsE;AACtE,qCAA+C;AAC/C,2CAIoB;AAEpB;;GAEG;AACH,MAAa,YAAY;IAiJvB,YACW,IAAY,EACZ,KAAa,EACb,GAAW,EACX,IAAY,EACZ,MAAc,EACd,MAAc,EACd,WAAoB,EACpB,eAAwB,EACxB,QAAiB,EACjB,QAAiB;QATjB,SAAI,GAAJ,IAAI,CAAQ;QACZ,UAAK,GAAL,KAAK,CAAQ;QACb,QAAG,GAAH,GAAG,CAAQ;QACX,SAAI,GAAJ,IAAI,CAAQ;QACZ,WAAM,GAAN,MAAM,CAAQ;QACd,WAAM,GAAN,MAAM,CAAQ;QACd,gBAAW,GAAX,WAAW,CAAS;QACpB,oBAAe,GAAf,eAAe,CAAS;QACxB,aAAQ,GAAR,QAAQ,CAAS;QACjB,aAAQ,GAAR,QAAQ,CAAS;IACzB,CAAC;IA3JJ,MAAM,CAAC,OAAO,CACZ,GAAW,EACX,IAAoB,EACpB,QAAiB;QAEjB,I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AAO;YACL,KAAK,EAAE,cAAc;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAA;IACH,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,IAAwC;QACtD,OAAO,IAAI,YAAY,CACrB,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,GAAG,EACR,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,QAAQ,CACd,CAAA;IACH,CAAC;CACF;AArQD,oCAqQC"}
@@ -1,17 +1,21 @@
1
1
  /// <reference types="node" />
2
2
  import * as bc from "batch-cluster";
3
+ import { ApplicationRecordTags } from "./ApplicationRecordTags";
3
4
  import { ExifDate } from "./ExifDate";
4
5
  import { ExifDateTime } from "./ExifDateTime";
5
6
  import { ExifToolTask } from "./ExifToolTask";
7
+ import { ICCProfileTags } from "./ICCProfileTags";
8
+ import { Maybe } from "./Maybe";
6
9
  import { PreviewTag } from "./PreviewTag";
7
- import { Tags } from "./Tags";
10
+ import { Struct } from "./Struct";
11
+ import { APP12Tags, APP14Tags, APP1Tags, APP4Tags, APP5Tags, APP6Tags, CompositeTags, EXIFTags, ExifToolTags, FileTags, FlashPixTags, IPTCTags, JFIFTags, MakerNotesTags, MetaTags, MPFTags, PanasonicRawTags, PhotoshopTags, PrintIMTags, QuickTimeTags, RAFTags, RIFFTags, Tags, XMPTags } from "./Tags";
8
12
  export { ExifDate } from "./ExifDate";
9
13
  export { ExifDateTime } from "./ExifDateTime";
10
14
  export { ExifTime } from "./ExifTime";
11
15
  export { ExifToolTask } from "./ExifToolTask";
12
16
  export { parseJSON } from "./JSON";
13
17
  export { offsetMinutesToZoneName, UnsetZone, UnsetZoneName, UnsetZoneOffsetMinutes, } from "./Timezones";
14
- export type { Tags };
18
+ export type { AdditionalWriteTags, APP12Tags, APP14Tags, APP1Tags, APP4Tags, APP5Tags, APP6Tags, ApplicationRecordTags, CompositeTags, EXIFTags, ExifToolTags, ExpandedDateTags, FileTags, FlashPixTags, ICCProfileTags, IPTCTags, JFIFTags, MakerNotesTags, Maybe, MetaTags, MPFTags, Omit, PanasonicRawTags, PhotoshopTags, PrintIMTags, QuickTimeTags, RAFTags, RIFFTags, Struct, Tags, XMPTags, };
15
19
  export declare const DefaultExifToolPath: string;
16
20
  export declare const DefaultExiftoolArgs: string[];
17
21
  /**
@@ -28,17 +32,13 @@ export interface ShortcutTags {
28
32
  }
29
33
  declare type AdditionalWriteTags = {
30
34
  "Orientation#"?: number;
31
- /**
32
- * Included because it's so rare, it doesn't always make the Tags build:
33
- */
34
- TimeZoneOffset?: number | string;
35
35
  };
36
36
  declare type ExpandedDateTags = {
37
37
  [K in keyof Tags]: (Tags[K] extends number ? number : Tags[K] extends ExifDateTime ? ExifDate | ExifDateTime : Tags[K]) | string;
38
38
  };
39
- declare type NotUndefined<T> = T extends undefined ? never : T;
39
+ export declare type Defined<T> = T extends undefined ? never : T;
40
40
  export declare type DefinedOrNullValued<T> = {
41
- [P in keyof T]: NotUndefined<T[P]> | null;
41
+ [P in keyof T]: Defined<T[P]> | null;
42
42
  };
43
43
  export declare type WriteTags = DefinedOrNullValued<ShortcutTags & AdditionalWriteTags & ExpandedDateTags>;
44
44
  export declare const DefaultMaxProcs: number;
@@ -320,6 +320,7 @@ export declare class ExifTool {
320
320
  * @return report why child processes were recycled
321
321
  */
322
322
  childEndCounts(): {
323
+ startError: number;
323
324
  broken: number;
324
325
  closed: number;
325
326
  ending: number;
package/dist/ExifTool.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];