exiftool-vendored 33.4.0 → 34.0.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +42 -30
  2. package/dist/Array.d.ts +41 -1
  3. package/dist/Array.js +42 -4
  4. package/dist/Array.js.map +1 -1
  5. package/dist/BinaryExtractionTask.d.ts +8 -0
  6. package/dist/BinaryExtractionTask.js +8 -0
  7. package/dist/BinaryExtractionTask.js.map +1 -1
  8. package/dist/CoordinateParser.d.ts +1 -1
  9. package/dist/CoordinateParser.js +3 -3
  10. package/dist/DefaultExifToolOptions.d.ts +3 -0
  11. package/dist/DefaultExifToolOptions.js +4 -1
  12. package/dist/DefaultExifToolOptions.js.map +1 -1
  13. package/dist/ExifTool.d.ts +6 -4
  14. package/dist/ExifTool.js +6 -4
  15. package/dist/ExifTool.js.map +1 -1
  16. package/dist/ExifToolOptions.d.ts +86 -80
  17. package/dist/ExifToolOptions.js.map +1 -1
  18. package/dist/File.d.ts +15 -0
  19. package/dist/File.js +17 -10
  20. package/dist/File.js.map +1 -1
  21. package/dist/Object.d.ts +34 -0
  22. package/dist/Object.js +29 -1
  23. package/dist/Object.js.map +1 -1
  24. package/dist/ReadRawTask.js +1 -1
  25. package/dist/ReadRawTask.js.map +1 -1
  26. package/dist/ReadTask.d.ts +1 -0
  27. package/dist/ReadTask.js +10 -6
  28. package/dist/ReadTask.js.map +1 -1
  29. package/dist/RewriteAllTagsTask.d.ts +10 -0
  30. package/dist/RewriteAllTagsTask.js +10 -0
  31. package/dist/RewriteAllTagsTask.js.map +1 -1
  32. package/dist/String.d.ts +2 -2
  33. package/dist/String.js +2 -2
  34. package/dist/Tags.d.ts +24 -24
  35. package/dist/Tags.js.map +1 -1
  36. package/dist/Timezones.d.ts +8 -4
  37. package/dist/Timezones.js +24 -16
  38. package/dist/Timezones.js.map +1 -1
  39. package/dist/VersionTask.d.ts +6 -0
  40. package/dist/VersionTask.js +6 -0
  41. package/dist/VersionTask.js.map +1 -1
  42. package/dist/WriteTask.d.ts +15 -0
  43. package/dist/WriteTask.js +15 -0
  44. package/dist/WriteTask.js.map +1 -1
  45. package/package.json +7 -7
@@ -14,24 +14,24 @@ export interface ExifToolOptions extends bc.BatchClusterOptions, bc.BatchProcess
14
14
  /**
15
15
  * The maximum number of ExifTool child processes to spawn when load merits.
16
16
  *
17
- * Defaults to 1/4 the number of CPUs, minimally 1.
17
+ * @default `Math.max(1, Math.floor(os.cpus().length / 4))`
18
18
  */
19
19
  maxProcs: number;
20
20
  /**
21
21
  * The maximum number of requests a given ExifTool process will service
22
22
  * before being retired.
23
23
  *
24
- * Defaults to 500, to balance performance with memory usage.
24
+ * @default 500
25
25
  */
26
26
  maxTasksPerProcess: number;
27
27
  /**
28
- * Spawning new ExifTool processes must not take longer than
29
- * {@link spawnTimeoutMillis} milliseconds before the child process is timed
30
- * out and a new attempt is made. Be pessimistic here--windows can regularly
31
- * take several seconds to spin up a process, thanks to antivirus
32
- * shenanigans. This can't be set to a value less than 100ms.
28
+ * Spawning new ExifTool processes must not take longer than this before the
29
+ * child process is timed out and a new attempt is made. Be pessimistic
30
+ * here--windows can regularly take several seconds to spin up a process,
31
+ * thanks to antivirus shenanigans. This can't be set to a value less than
32
+ * 100ms.
33
33
  *
34
- * Defaults to 30 seconds, to accommodate slow Windows machines.
34
+ * @default 30000 (30 seconds)
35
35
  */
36
36
  spawnTimeoutMillis: number;
37
37
  /**
@@ -39,49 +39,54 @@ export interface ExifToolOptions extends bc.BatchClusterOptions, bc.BatchProcess
39
39
  * process is dead and we should restart the task. This can't be set to a
40
40
  * value less than 10ms, and really should be set to at more than a second
41
41
  * unless `taskRetries` is sufficiently large or all writes will be to a
42
- * fast local disk. Defaults to 10 seconds.
42
+ * fast local disk.
43
+ *
44
+ * @default 30000 (30 seconds)
43
45
  */
44
46
  taskTimeoutMillis: number;
45
47
  /**
46
48
  * An interval timer is scheduled to do periodic maintenance of underlying
47
49
  * child processes with this periodicity.
48
50
  *
49
- * Defaults to 2 seconds.
51
+ * @default 2000 (2 seconds)
50
52
  */
51
53
  onIdleIntervalMillis: number;
52
54
  /**
53
55
  * The number of times a task can error or timeout and be retried.
54
56
  *
55
- * Defaults to 1 (every task gets 2 chances).
57
+ * @default 1 (every task gets 2 chances)
56
58
  */
57
59
  taskRetries: number;
58
60
  /**
59
- * Allows for non-standard paths to ExifTool. Defaults to the perl or
60
- * windows binaries provided by `exiftool-vendored.pl` or
61
- * `exiftool-vendored.exe`.
61
+ * Allows for non-standard paths to ExifTool.
62
62
  *
63
63
  * This must be the full path to `exiftool`, not just the directory.
64
+ *
65
+ * @default Path to vendored ExifTool binary
64
66
  */
65
67
  exiftoolPath: string | Promise<string> | ((logger?: bc.Logger) => string | Promise<string>);
66
68
  /**
67
69
  * Args only passed to exiftool on launch. You probably don't need to change
68
70
  * this from the default.
71
+ *
72
+ * @default `["-charset", "filename=utf8"]`
69
73
  */
70
74
  exiftoolArgs: string[];
71
75
  /**
72
76
  * Environment variables passed to ExifTool (besides `EXIFTOOL_HOME`)
77
+ *
78
+ * @default `{}`
73
79
  */
74
80
  exiftoolEnv: NodeJS.ProcessEnv;
75
81
  /**
76
82
  * Should ExifTool use MWG (Metadata Working Group) composite tags for
77
83
  * reading and writing tags?
78
84
  *
79
- * ExifTool recommends this to be set to true.
80
- *
81
- * Note that this can result in many tag value differences from
82
- * `ExifTool.read`, and makes `ExifTool.write` write to "synonymous" MWG
83
- * tags automatically.
85
+ * ExifTool recommends this to be set to `true`. Note that this can result
86
+ * in many tag value differences from `ExifTool.read`, and makes
87
+ * `ExifTool.write` write to "synonymous" MWG tags automatically.
84
88
  *
89
+ * @default true
85
90
  * @see https://exiftool.org/TagNames/MWG.html for details
86
91
  */
87
92
  useMWG: boolean;
@@ -92,9 +97,7 @@ export interface ExifToolOptions extends bc.BatchClusterOptions, bc.BatchProcess
92
97
  * If you're using tag values only for human consumption, you may want to
93
98
  * leave this blank.
94
99
  *
95
- * The default includes "*Duration*", {@link Tags.GPSAltitude},
96
- * {@link Tags.GPSLatitude}, {@link Tags.GPSLongitude},
97
- * {@link Tags.GPSPosition}, and {@link Tags.Orientation}.
100
+ * @default `["*Duration*", "GPSAltitude", "GPSLatitude", "GPSLongitude", "GPSPosition", "GeolocationPosition", "Orientation"]`
98
101
  */
99
102
  numericTags: string[];
100
103
  /**
@@ -105,7 +108,7 @@ export interface ExifToolOptions extends bc.BatchClusterOptions, bc.BatchProcess
105
108
  * MRW, RAF, X3F, IIQ, JP2, JXL, HEIC and AVIF images, MOV/MP4 videos, and
106
109
  * some RIFF-based files such as AVI, WAV and WEBP.
107
110
  *
108
- * This defaults to undefined, as it adds ~20ms of overhead to every read
111
+ * @default false (disabled, as it adds ~20ms of overhead to every read)
109
112
  */
110
113
  imageHashType: false | "MD5" | "SHA256" | "SHA512";
111
114
  /**
@@ -114,8 +117,9 @@ export interface ExifToolOptions extends bc.BatchClusterOptions, bc.BatchProcess
114
117
  includeImageDataMD5: boolean | undefined;
115
118
  /**
116
119
  * Video file dates are assumed to be in UTC, rather than using timezone
117
- * inference used in images. To disable this default, set this to false.
120
+ * inference used in images. To disable this default, set this to `false`.
118
121
  *
122
+ * @default true
119
123
  * @see https://github.com/photostructure/exiftool-vendored.js/issues/113
120
124
  */
121
125
  defaultVideosToUTC: boolean;
@@ -127,11 +131,7 @@ export interface ExifToolOptions extends bc.BatchClusterOptions, bc.BatchProcess
127
131
  * Setting this to `false` removes **all** timezone inference--only those
128
132
  * date-times with an explicit offset will have a defined timezone.
129
133
  *
130
- * Prior versions of exiftool-vendored would use the file's `.tz` as a
131
- * backstop even if this was set to `false`.
132
- *
133
- * As of version 23, this now defaults to `true`, as it's more likely to be
134
- * what people expect.
134
+ * @default true
135
135
  */
136
136
  backfillTimezones: boolean;
137
137
  /**
@@ -143,8 +143,7 @@ export interface ExifToolOptions extends bc.BatchClusterOptions, bc.BatchProcess
143
143
  * timezone from non-UTC datestamps included in the
144
144
  * {@link inferTimezoneFromDatestampTags} value.
145
145
  *
146
- * This defaults to false as it both retains prior behavior and means fewer
147
- * "fuzzy" heuristics are enabled by default.
146
+ * @default false (fewer "fuzzy" heuristics are enabled by default)
148
147
  */
149
148
  inferTimezoneFromDatestamps: boolean;
150
149
  /**
@@ -156,52 +155,52 @@ export interface ExifToolOptions extends bc.BatchClusterOptions, bc.BatchProcess
156
155
  * This setting is only in play if {@link inferTimezoneFromDatestamps} has
157
156
  * been overridden to be `true`.
158
157
  *
159
- * This defaults to {@link CapturedAtTagNames}
158
+ * @default {@link CapturedAtTagNames}
160
159
  */
161
160
  inferTimezoneFromDatestampTags: (keyof Tags)[];
162
161
  /**
163
162
  * Some cameras (Samsung Galaxy S7, for example) may not always include GPS
164
- * metadata in photos if a fix can't be obtained. If this option is true, and
165
- * GPS metadata is missing, we'll try to infer the timezone from the
163
+ * metadata in photos if a fix can't be obtained. If this option is `true`,
164
+ * and GPS metadata is missing, we'll try to infer the timezone from the
166
165
  * difference of the TimeStamp tag and the first defined tag value from
167
166
  * {@link inferTimezoneFromDatestampTags}.
168
167
  *
169
168
  * This heuristic is pretty sketchy, and used as a last resort. You shouldn't
170
169
  * enable it unless you have to.
171
170
  *
171
+ * @default false
172
172
  * @see https://github.com/photostructure/exiftool-vendored.js/issues/209
173
173
  */
174
174
  inferTimezoneFromTimeStamp: boolean;
175
175
  /**
176
176
  * Some software uses a GPS position of (0,0) as a synonym for "unset". If
177
- * this option is true, and GPSLatitude and GPSLongitude are both 0, then
177
+ * this option is `true`, and GPSLatitude and GPSLongitude are both 0, then
178
178
  * those values will be returned, but the TZ will not be inferred from that
179
179
  * location.
180
180
  *
181
181
  * If both this and {@link geolocation} are `true`, we will _delete_ the
182
182
  * Geolocation tags from the returned metadata object.
183
183
  *
184
+ * @default true
184
185
  * @see https://en.wikipedia.org/wiki/Null_Island
185
186
  */
186
187
  ignoreZeroZeroLatLon: boolean;
187
188
  /**
188
189
  * Override the default geo-to-timezone lookup service. Note that if
189
- {@link geolocation} is enabled, we'll use
190
- {@link Tags.GeolocationTimeZone} if it's not blank.
191
- *
192
- * This defaults to `@photostructure/tz-lookup`, but if you have the
193
- * resources, consider using `geo-tz` for more accurate results.
190
+ * {@link geolocation} is enabled, we'll use {@link Tags.GeolocationTimeZone}
191
+ * if it's not blank.
194
192
  *
195
- * If your implementation throws an error, `ExifTool` will consider that given
196
- * latitude/longitude as invalid.
193
+ * If your implementation throws an error, `ExifTool` will consider that
194
+ * given latitude/longitude as invalid.
197
195
  *
198
- * Here's a snippet of how to use `geo-tz` instead of `tz-lookup`:
196
+ * @default `@photostructure/tz-lookup` (consider `geo-tz` for more accuracy)
199
197
  *
200
- ```js
201
- const geotz = require("geo-tz")
202
- const { ExifTool } = require("exiftool-vendored")
203
- const exiftool = new ExifTool({ geoTz: (lat, lon) => geotz.find(lat, lon)[0] })
204
- ```
198
+ * @example
199
+ * ```js
200
+ * const geotz = require("geo-tz")
201
+ * const { ExifTool } = require("exiftool-vendored")
202
+ * const exiftool = new ExifTool({ geoTz: (lat, lon) => geotz.find(lat, lon)[0] })
203
+ * ```
205
204
  *
206
205
  * @see https://github.com/photostructure/tz-lookup
207
206
  * @see https://github.com/evansiroky/node-geo-tz/
@@ -211,6 +210,7 @@ export interface ExifToolOptions extends bc.BatchClusterOptions, bc.BatchProcess
211
210
  * When reading metadata, should we enable ExifTool's geolocation features?
212
211
  * Note that this requires ExifTool version 12.78 or later.
213
212
  *
213
+ * @default false
214
214
  * @see https://exiftool.org/geolocation.html
215
215
  * @see {@link GeolocationTags}
216
216
  */
@@ -218,15 +218,15 @@ export interface ExifToolOptions extends bc.BatchClusterOptions, bc.BatchProcess
218
218
  /**
219
219
  * Should we ignore minor errors when reading metadata?
220
220
  *
221
- * This defaults to `true`, as ExifTool can be quite chatty.
221
+ * @default true (ExifTool can be quite chatty)
222
222
  */
223
223
  ignoreMinorErrors: boolean;
224
224
  /**
225
- * When writing an extracted tag to a file,
226
- * this will overwrite an existing file instead of throwing an error.
227
- * Enabling this option is equivalent to `-w!` in ExifTool.
225
+ * When writing an extracted tag to a file, this will overwrite an existing
226
+ * file instead of throwing an error. Enabling this option is equivalent to
227
+ * `-w!` in ExifTool.
228
228
  *
229
- * This defaults to `false`.
229
+ * @default false
230
230
  */
231
231
  forceWrite: boolean;
232
232
  /**
@@ -237,40 +237,46 @@ export interface ExifToolOptions extends bc.BatchClusterOptions, bc.BatchProcess
237
237
  * Lambda), but `perl` may be available in your `PATH` some place else (like
238
238
  * `/opt/bin/perl`), if you pull in a perl layer.
239
239
  *
240
- * This will default to `true` in those environments as a workaround in these
241
- * situations. Note also that `perl` will be spawned in a sub-shell.
240
+ * Note that when enabled, `perl` will be spawned in a sub-shell.
241
+ *
242
+ * @default `true` on systems without `/usr/bin/perl`, `false` otherwise
242
243
  */
243
244
  ignoreShebang: boolean;
244
245
  /**
245
- * Should we check for a readable and executable `perl` file in $PATH? This
246
- * defaults to false on Windows, and true everywhere else. Set this to false
247
- * if you know perl is installed.
246
+ * Should we check for a readable and executable `perl` file in $PATH? Set
247
+ * this to `false` if you know perl is installed.
248
+ *
249
+ * @default `false` on Windows, `true` elsewhere
248
250
  */
249
251
  checkPerl: boolean;
250
252
  /**
251
253
  * How should ExifTool handle nested structures?
252
254
  *
253
- * Defaults to `1`.
254
- *
255
- * - `0` = Read/copy flattened tags
256
- * - `1` = Read/copy structures
257
- * - `2` = Read/copy both flattened and structured tags, but flag flattened
255
+ * - `0` = Read/copy flattened tags
256
+ * - `1` = Read/copy structures
257
+ * - `2` = Read/copy both flattened and structured tags, but flag flattened
258
258
  * tags as "unsafe" for copying
259
259
  * - `"undef"` = Same as `0` for reading and `2` for copying
260
260
  *
261
+ * @default 1
261
262
  * @see https://exiftool.org/struct.html
262
263
  */
263
264
  struct: "undef" | 0 | 1 | 2;
264
265
  /**
265
- * Any additional arguments that should be added by default to all read tasks,
266
- * like `["-fast", "-api", "largefilesupport=1"]`. The value provided to the
267
- * ExifTool constructor can be overridden in the call to {@link ExifTool.read}
266
+ * Any additional arguments that should be added by default to all read
267
+ * tasks, like `["-fast", "-api", "largefilesupport=1"]`. The value provided
268
+ * to the ExifTool constructor can be overridden in the call to
269
+ * {@link ExifTool.read}.
270
+ *
271
+ * @default `["-fast"]`
268
272
  */
269
273
  readArgs: string[];
270
274
  /**
271
275
  * Any additional arguments that should be added by default to all write
272
276
  * tasks, like `["-overwrite_original"]`. The value provided to the ExifTool
273
277
  * constructor can be overridden in the call to {@link ExifTool.write}.
278
+ *
279
+ * @default `[]`
274
280
  */
275
281
  writeArgs: string[];
276
282
  /**
@@ -279,13 +285,13 @@ export interface ExifToolOptions extends bc.BatchClusterOptions, bc.BatchProcess
279
285
  * Unfortunately, at least for some Nikon cameras, the TimeZone tag **and the
280
286
  * DaylightSavings tag** must be taken into account to find the UTC offset.
281
287
  *
282
- * By default, this is a predicate that returns `true` if the `Make` tag is
283
- * `Nikon`. If you find other makes and models that need this treatment,
284
- * please open a ticket on GitHub with example images or videos and we can
285
- * update the default predicate.
288
+ * If you find other makes and models that need this treatment, please open a
289
+ * ticket on GitHub with example images or videos and we can update the
290
+ * default predicate.
286
291
  *
287
292
  * The return value is the number of minutes to adjust the timezone by.
288
293
  *
294
+ * @default Returns 60 for Nikon cameras when `DaylightSavings` is `true`
289
295
  * @see https://github.com/photostructure/exiftool-vendored.js/issues/215
290
296
  */
291
297
  adjustTimeZoneIfDaylightSavings: (tags: Tags, tz: string) => Maybe<number>;
@@ -297,20 +303,20 @@ export interface ExifToolOptions extends bc.BatchClusterOptions, bc.BatchProcess
297
303
  * values assigned to {@link TimezoneOffsetTagnames}.
298
304
  *
299
305
  * Note that there **are** regions that have had their IANA timezone change
300
- * over time--this will result incorrect timezones.
306
+ * over time--this will result in incorrect timezones.
307
+ *
308
+ * @default false
301
309
  */
302
310
  preferTimezoneInferenceFromGps: boolean;
303
311
  /**
304
312
  * Should ExifTool keep times that are stored as seconds since UTC epoch as
305
- * UTC times? If false, ExifTool will use local time instead of UTC/Zulu.
306
- *
307
- * We default to `true` to ensure we don't unintentionally adopt local
308
- * timezones.
313
+ * UTC times? If `false`, ExifTool will use local time instead of UTC/Zulu.
309
314
  *
310
- * Please note: when trying to validate this option, I **could not find a
311
- * single example** that had a unixtime-encoded datetime, so I suspect this is
312
- * irrelevant for most use cases and files.
315
+ * Note: when trying to validate this option, we could not find a single
316
+ * example that had a unixtime-encoded datetime, so this is likely irrelevant
317
+ * for most use cases and files.
313
318
  *
319
+ * @default true (to avoid unintentionally adopting local timezones)
314
320
  * @see https://exiftool.org/ExifTool.html#KeepUTCTime
315
321
  */
316
322
  keepUTCTime: boolean;
@@ -318,14 +324,14 @@ export interface ExifToolOptions extends bc.BatchClusterOptions, bc.BatchProcess
318
324
  * Timeout in milliseconds for synchronous disposal (using Symbol.dispose).
319
325
  * If graceful cleanup takes longer than this, forceful cleanup is attempted.
320
326
  *
321
- * Defaults to 1000ms (1 second).
327
+ * @default 1000 (1 second)
322
328
  */
323
329
  disposalTimeoutMs?: number;
324
330
  /**
325
331
  * Timeout in milliseconds for asynchronous disposal (using Symbol.asyncDispose).
326
332
  * If graceful cleanup takes longer than this, forceful cleanup is attempted.
327
333
  *
328
- * Defaults to 5000ms (5 seconds).
334
+ * @default 5000 (5 seconds)
329
335
  */
330
336
  asyncDisposalTimeoutMs?: number;
331
337
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ExifToolOptions.js","sourceRoot":"","sources":["../src/ExifToolOptions.ts"],"names":[],"mappings":";;AAmXA,0DASC;AATD,SAAgB,uBAAuB,CAIrC,OAAU;IACV,IAAI,OAAO,CAAC,aAAa,IAAI,IAAI,IAAI,OAAO,CAAC,mBAAmB,IAAI,IAAI,EAAE,CAAC;QACzE,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IACtE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
1
+ {"version":3,"file":"ExifToolOptions.js","sourceRoot":"","sources":["../src/ExifToolOptions.ts"],"names":[],"mappings":";;AA0XA,0DASC;AATD,SAAgB,uBAAuB,CAIrC,OAAU;IACV,IAAI,OAAO,CAAC,aAAa,IAAI,IAAI,IAAI,OAAO,CAAC,mBAAmB,IAAI,IAAI,EAAE,CAAC;QACzE,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IACtE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/dist/File.d.ts CHANGED
@@ -1,3 +1,18 @@
1
+ /**
2
+ * Checks if a file is empty or does not exist.
3
+ * @param path - the file path to check
4
+ * @returns true if the file is empty or does not exist, false otherwise
5
+ * @throws if path is blank or if a non-ENOENT error occurs
6
+ */
1
7
  export declare function isFileEmpty(path: string): Promise<boolean>;
8
+ /**
9
+ * Returns true if the current platform has case-sensitive file paths.
10
+ */
2
11
  export declare const isPlatformCaseSensitive: import("./Lazy").Lazy<boolean>;
12
+ /**
13
+ * Compares two file paths for equality, respecting platform case sensitivity.
14
+ * @param a - first file path
15
+ * @param b - second file path
16
+ * @returns true if paths refer to the same file
17
+ */
3
18
  export declare function compareFilePaths(a: string, b: string): boolean;
package/dist/File.js CHANGED
@@ -3,24 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isPlatformCaseSensitive = void 0;
4
4
  exports.isFileEmpty = isFileEmpty;
5
5
  exports.compareFilePaths = compareFilePaths;
6
- const node_fs_1 = require("node:fs");
6
+ const promises_1 = require("node:fs/promises");
7
7
  const node_path_1 = require("node:path");
8
8
  const Lazy_1 = require("./Lazy");
9
9
  const String_1 = require("./String");
10
+ /**
11
+ * Checks if a file is empty or does not exist.
12
+ * @param path - the file path to check
13
+ * @returns true if the file is empty or does not exist, false otherwise
14
+ * @throws if path is blank or if a non-ENOENT error occurs
15
+ */
10
16
  async function isFileEmpty(path) {
11
17
  if ((0, String_1.blank)(path)) {
12
18
  throw new Error("isFileEmpty(): blank path");
13
19
  }
14
- // TODO: convert this to using fs/promises once node 12 is EOL (2022-04-30)
15
20
  try {
16
- const s = await new Promise((res, rej) => {
17
- try {
18
- (0, node_fs_1.stat)(path, (err, val) => (err == null ? res(val) : rej(err)));
19
- }
20
- catch (err) {
21
- rej(err);
22
- }
23
- });
21
+ const s = await (0, promises_1.stat)(path);
24
22
  return s == null || s.size === 0;
25
23
  }
26
24
  catch (err) {
@@ -33,7 +31,16 @@ async function isFileEmpty(path) {
33
31
  throw err;
34
32
  }
35
33
  }
34
+ /**
35
+ * Returns true if the current platform has case-sensitive file paths.
36
+ */
36
37
  exports.isPlatformCaseSensitive = (0, Lazy_1.lazy)(() => process.platform !== "win32" && process.platform !== "darwin");
38
+ /**
39
+ * Compares two file paths for equality, respecting platform case sensitivity.
40
+ * @param a - first file path
41
+ * @param b - second file path
42
+ * @returns true if paths refer to the same file
43
+ */
37
44
  function compareFilePaths(a, b) {
38
45
  const aNorm = (0, node_path_1.normalize)(a);
39
46
  const bNorm = (0, node_path_1.normalize)(b);
package/dist/File.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"File.js","sourceRoot":"","sources":["../src/File.ts"],"names":[],"mappings":";;;AAKA,kCAyBC;AAMD,4CAMC;AA1CD,qCAAsC;AACtC,yCAAsC;AACtC,iCAA8B;AAC9B,qCAAiC;AAE1B,KAAK,UAAU,WAAW,CAAC,IAAY;IAC5C,IAAI,IAAA,cAAK,EAAC,IAAI,CAAC,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IAED,2EAA2E;IAC3E,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,MAAM,IAAI,OAAO,CAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAC9C,IAAI,CAAC;gBACH,IAAA,cAAI,EAAC,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,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AAW,CAAC,IAAY;IAC5C,IAAI,IAAA,cAAK,EAAC,IAAI,CAAC,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,MAAM,IAAA,eAAI,EAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,IACE,GAAG;YACH,OAAO,GAAG,KAAK,QAAQ;YACvB,MAAM,IAAI,GAAG;YACb,GAAG,CAAC,IAAI,KAAK,QAAQ;YAErB,OAAO,IAAI,CAAC;;YACT,MAAM,GAAG,CAAC;IACjB,CAAC;AACH,CAAC;AAED;;GAEG;AACU,QAAA,uBAAuB,GAAG,IAAA,WAAI,EACzC,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,CACpE,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,CAAS,EAAE,CAAS;IACnD,MAAM,KAAK,GAAG,IAAA,qBAAS,EAAC,CAAC,CAAC,CAAC;IAC3B,MAAM,KAAK,GAAG,IAAA,qBAAS,EAAC,CAAC,CAAC,CAAC;IAC3B,OAAO,IAAA,+BAAuB,GAAE;QAC9B,CAAC,CAAC,KAAK,KAAK,KAAK;QACjB,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;AAC3E,CAAC"}
package/dist/Object.d.ts CHANGED
@@ -1,6 +1,27 @@
1
1
  import { Nullable } from "./Maybe";
2
+ /**
3
+ * Type guard that checks if a value is a non-null, non-array object.
4
+ *
5
+ * @param obj - The value to check
6
+ * @returns `true` if `obj` is a plain object (not null, not an array)
7
+ */
2
8
  export declare function isObject(obj: unknown): obj is object;
9
+ /**
10
+ * Returns an array of own enumerable string keys from an object.
11
+ *
12
+ * Unlike `Object.keys`, this filters to only own enumerable properties and
13
+ * returns an empty array for null/undefined inputs.
14
+ *
15
+ * @param o - The object to extract keys from
16
+ * @returns Array of own enumerable string keys, or empty array if `o` is nullish
17
+ */
3
18
  export declare function keys<T extends object, K extends string & keyof T>(o: T): K[];
19
+ /**
20
+ * Type guard that checks if a value is a function.
21
+ *
22
+ * @param obj - The value to check
23
+ * @returns `true` if `obj` is a function
24
+ */
4
25
  export declare function isFunction(obj: unknown): obj is (...args: unknown[]) => unknown;
5
26
  /**
6
27
  * Turns an array of `[key, value]` pairs into an object.
@@ -9,9 +30,22 @@ export declare function isFunction(obj: unknown): obj is (...args: unknown[]) =>
9
30
  * - If `base` is provided it is mutated and returned (handy for “extend” use‑cases).
10
31
  */
11
32
  export declare function fromEntries<K extends PropertyKey, V = unknown>(pairs: Nullable<Nullable<[Nullable<K>, V]>[]>, base?: Record<K, V>): Record<K, V>;
33
+ /**
34
+ * Utility type that removes specified keys from a type by setting their values to `never`.
35
+ *
36
+ * @typeParam T - The source object type
37
+ * @typeParam U - The keys to exclude
38
+ */
12
39
  export type Unpick<T, U> = {
13
40
  [P in keyof T]: P extends U ? never : T[P];
14
41
  };
42
+ /**
43
+ * Returns a shallow copy of an object with the specified keys omitted.
44
+ *
45
+ * @param t - The source object
46
+ * @param keysToOmit - Keys to exclude from the result
47
+ * @returns A new object without the specified keys
48
+ */
15
49
  export declare function omit<T extends object, S extends string>(t: T, ...keysToOmit: S[]): Unpick<T, S>;
16
50
  /**
17
51
  * Provides a type-safe exhaustive array of keys for a given interface.
package/dist/Object.js CHANGED
@@ -6,14 +6,35 @@ exports.isFunction = isFunction;
6
6
  exports.fromEntries = fromEntries;
7
7
  exports.omit = omit;
8
8
  exports.keysOf = keysOf;
9
+ /**
10
+ * Type guard that checks if a value is a non-null, non-array object.
11
+ *
12
+ * @param obj - The value to check
13
+ * @returns `true` if `obj` is a plain object (not null, not an array)
14
+ */
9
15
  function isObject(obj) {
10
- return typeof obj === "object" && obj !== null;
16
+ return obj != null && typeof obj === "object" && !Array.isArray(obj);
11
17
  }
18
+ /**
19
+ * Returns an array of own enumerable string keys from an object.
20
+ *
21
+ * Unlike `Object.keys`, this filters to only own enumerable properties and
22
+ * returns an empty array for null/undefined inputs.
23
+ *
24
+ * @param o - The object to extract keys from
25
+ * @returns Array of own enumerable string keys, or empty array if `o` is nullish
26
+ */
12
27
  function keys(o) {
13
28
  return o == null
14
29
  ? []
15
30
  : Object.keys(o).filter((ea) => ({}).propertyIsEnumerable.call(o, ea));
16
31
  }
32
+ /**
33
+ * Type guard that checks if a value is a function.
34
+ *
35
+ * @param obj - The value to check
36
+ * @returns `true` if `obj` is a function
37
+ */
17
38
  function isFunction(obj) {
18
39
  return typeof obj === "function";
19
40
  }
@@ -34,6 +55,13 @@ function fromEntries(pairs, base = {}) {
34
55
  }
35
56
  return base;
36
57
  }
58
+ /**
59
+ * Returns a shallow copy of an object with the specified keys omitted.
60
+ *
61
+ * @param t - The source object
62
+ * @param keysToOmit - Keys to exclude from the result
63
+ * @returns A new object without the specified keys
64
+ */
37
65
  function omit(t, ...keysToOmit) {
38
66
  const result = {};
39
67
  for (const k of keys(t).filter((ea) => !keysToOmit.includes(ea))) {
@@ -1 +1 @@
1
- {"version":3,"file":"Object.js","sourceRoot":"","sources":["../src/Object.ts"],"names":[],"mappings":";;AAEA,4BAEC;AAED,oBAMC;AAED,gCAIC;AAQD,kCAaC;AAID,oBAWC;AAWD,wBAEC;AAjED,SAAgB,QAAQ,CAAC,GAAY;IACnC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,CAAC;AACjD,CAAC;AAED,SAAgB,IAAI,CAA+C,CAAI;IACrE,OAAO,CAAC,IAAI,IAAI;QACd,CAAC,CAAC,EAAE;QACJ,CAAC,CAAE,MAAM,CAAC,IAAI,CAAC,CAAC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AAUD;;;;;;GAMG;AACH,SAAgB,IAAI,CAClB,CAAI,EACJ,GAAG,UAAe;IAElB,MAAM,MAAM,GAAG,EAAO,CAAC;IACvB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAC5B,CAAC,EAAE,EAAE,EAAE,CAAC,CAAE,UAAuB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAChC,EAAE,CAAC;QACjB,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;IACD,OAAO,MAAsB,CAAC;AAChC,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,MAAM,CAAI,CAAkC;IAC1D,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAgB,CAAC;AACvC,CAAC;AAED,uDAAuD;AAEvD,yGAAyG"}
@@ -73,7 +73,7 @@ class ReadRawTask extends ExifToolTask_1.ExifToolTask {
73
73
  this.args = args;
74
74
  }
75
75
  toString() {
76
- return "ReadRawTask" + this.sourceFile + ")";
76
+ return "ReadRawTask(" + this.sourceFile + ")";
77
77
  }
78
78
  parse(data, err) {
79
79
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"ReadRawTask.js","sourceRoot":"","sources":["../src/ReadRawTask.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAuC;AACvC,iDAAmC;AACnC,qEAAkE;AAClE,2DAAwD;AAExD,iDAA8C;AAC9C,+DAAgE;AAChE,iCAA8B;AAGjB,QAAA,uBAAuB,GAAG;IACrC,UAAU;IACV,mBAAmB;IACnB,QAAQ;CACoC,CAAC;AAElC,QAAA,yBAAyB,GAAG;IACvC,GAAG,IAAA,WAAI,EAAC,+CAAsB,EAAE,GAAG,+BAAuB,CAAC;CAChB,CAAC;AAI9C,MAAa,WAAY,SAAQ,2BAAqB;IAkBzC;IACS;IAlBpB,MAAM,CAAC,GAAG,CAAC,QAAgB,EAAE,O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AI,WAAW,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAED,YACW,UAAkB,EACT,IAAc,EAChC,OAAqC;QAErC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAJZ,eAAU,GAAV,UAAU,CAAQ;QACT,SAAI,GAAJ,IAAI,CAAU;IAIlC,CAAC;IAEQ,QAAQ;QACf,OAAO,cAAc,GAAG,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;IAChD,CAAC;IAES,KAAK,CAAC,IAAY,EAAE,GAAW;QACvC,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACjC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,qCAAiB,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC3D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,SAAS,EAAE,CAAC;YACnB,IAAA,sBAAM,GAAE,CAAC,KAAK,CAAC,sCAAsC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;YACjE,MAAM,GAAG,IAAI,SAAS,CAAC;QACzB,CAAC;IACH,CAAC;CACF;AAzCD,kCAyCC"}
@@ -34,6 +34,7 @@ export declare class ReadTask extends ExifToolTask<Tags> {
34
34
  * @param sourceFile the file to read
35
35
  * @param args the full arguments to pass to exiftool that take into account
36
36
  * the flags in `options`
37
+ * @param options the required options for reading metadata
37
38
  */
38
39
  constructor(sourceFile: string, args: string[], options: Required<ReadTaskOptions>);
39
40
  static for(filename: string, options: ReadTaskOptions): ReadTask;
package/dist/ReadTask.js CHANGED
@@ -108,6 +108,7 @@ class ReadTask extends ExifToolTask_1.ExifToolTask {
108
108
  * @param sourceFile the file to read
109
109
  * @param args the full arguments to pass to exiftool that take into account
110
110
  * the flags in `options`
111
+ * @param options the required options for reading metadata
111
112
  */
112
113
  constructor(sourceFile, args, options) {
113
114
  super(args, options);
@@ -155,7 +156,7 @@ class ReadTask extends ExifToolTask_1.ExifToolTask {
155
156
  return new ReadTask(sourceFile, args, opts);
156
157
  }
157
158
  toString() {
158
- return "ReadTask" + this.sourceFile + ")";
159
+ return "ReadTask(" + this.sourceFile + ")";
159
160
  }
160
161
  // only exposed for tests
161
162
  parse(data, err) {
@@ -317,12 +318,15 @@ class ReadTask extends ExifToolTask_1.ExifToolTask {
317
318
  return value;
318
319
  }
319
320
  if (tagName.startsWith("GPS") || tagName.startsWith("Geolocation")) {
320
- if (this.#gpsIsInvalid())
321
+ if (this.#gpsIsInvalid()) {
322
+ // No GPS data should be trusted!
321
323
  return undefined;
322
- // If we parsed out a better value, use that:
323
- const parsed = this.#gpsResults()[tagName];
324
- if (parsed != null)
325
- return parsed;
324
+ }
325
+ const gpsResult = this.#gpsResults()?.[tagName];
326
+ if (gpsResult != null) {
327
+ // If we parsed out a better value, use that:
328
+ return gpsResult;
329
+ }
326
330
  // Otherwise, parse the raw value like any other tag: (It might be
327
331
  // something like "GPSTimeStamp"):
328
332
  }