@ac-kit/cmd-exiftool 0.0.0-stage → 0.1.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/CHANGELOG.md +42 -0
- package/LICENSE +28 -0
- package/README.md +176 -2
- package/dist/_argfile.d.ts +41 -0
- package/dist/_argfile.d.ts.map +1 -0
- package/dist/_argfile.js +99 -0
- package/dist/_argfile.js.map +1 -0
- package/dist/_inspect-file.d.ts +32 -0
- package/dist/_inspect-file.d.ts.map +1 -0
- package/dist/_inspect-file.js +103 -0
- package/dist/_inspect-file.js.map +1 -0
- package/dist/_parse-json-output.d.ts +31 -0
- package/dist/_parse-json-output.d.ts.map +1 -0
- package/dist/_parse-json-output.js +132 -0
- package/dist/_parse-json-output.js.map +1 -0
- package/dist/_print-read-arguments.d.ts +42 -0
- package/dist/_print-read-arguments.d.ts.map +1 -0
- package/dist/_print-read-arguments.js +152 -0
- package/dist/_print-read-arguments.js.map +1 -0
- package/dist/_process-handle.d.ts +7 -0
- package/dist/_process-handle.d.ts.map +1 -0
- package/dist/_process-handle.js +2 -0
- package/dist/_process-handle.js.map +1 -0
- package/dist/_response-reader.d.ts +54 -0
- package/dist/_response-reader.d.ts.map +1 -0
- package/dist/_response-reader.js +129 -0
- package/dist/_response-reader.js.map +1 -0
- package/dist/_worker.d.ts +104 -0
- package/dist/_worker.d.ts.map +1 -0
- package/dist/_worker.js +327 -0
- package/dist/_worker.js.map +1 -0
- package/dist/date-time.d.ts +28 -0
- package/dist/date-time.d.ts.map +1 -0
- package/dist/date-time.js +74 -0
- package/dist/date-time.js.map +1 -0
- package/dist/errors.d.ts +125 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +151 -0
- package/dist/errors.js.map +1 -0
- package/dist/exiftool-pool.d.ts +203 -0
- package/dist/exiftool-pool.d.ts.map +1 -0
- package/dist/exiftool-pool.js +455 -0
- package/dist/exiftool-pool.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/metadata.d.ts +46 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js +8 -0
- package/dist/metadata.js.map +1 -0
- package/dist/read-options.d.ts +86 -0
- package/dist/read-options.d.ts.map +1 -0
- package/dist/read-options.js +2 -0
- package/dist/read-options.js.map +1 -0
- package/dist/version.d.ts +39 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +53 -0
- package/dist/version.js.map +1 -0
- package/package.json +61 -3
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
import { win32 } from "node:path";
|
|
2
|
+
import { setLongTimeout } from "@ac-kit/core";
|
|
3
|
+
import { DoublyLinkedList } from "@ac-kit/data";
|
|
4
|
+
import { inspectFile } from "./_inspect-file.js";
|
|
5
|
+
import { findExiftoolMessage, parseJsonOutput } from "./_parse-json-output.js";
|
|
6
|
+
import { printPathArgument, printReadArguments, } from "./_print-read-arguments.js";
|
|
7
|
+
import { ExiftoolWorker, } from "./_worker.js";
|
|
8
|
+
import { ExiftoolCommandError, ExiftoolLimitError, ExiftoolOutputError, ExiftoolPoolClosedError, ExiftoolVersionError, } from "./errors.js";
|
|
9
|
+
import { compareExiftoolVersions, EXIFTOOL_TEXT_SCALARS_VERSION, } from "./version.js";
|
|
10
|
+
const DEFAULT_MAX_RESPONSE_BYTES_ = 16 * 1024 * 1024;
|
|
11
|
+
const DEFAULT_MAX_STDERR_BYTES_ = 64 * 1024;
|
|
12
|
+
const MAX_TIMER_MS_ = 2147483647;
|
|
13
|
+
/**
|
|
14
|
+
* A pool of `exiftool -stay_open True -@ -` processes, reading metadata as
|
|
15
|
+
* typed JSON without paying Perl's start-up for every file.
|
|
16
|
+
*
|
|
17
|
+
* - Nothing is spawned until the first request. A process answers `-ver` first
|
|
18
|
+
* and is refused below `EXIFTOOL_MINIMUM_VERSION`. No exiftool configuration
|
|
19
|
+
* file is loaded unless `configFile` names one.
|
|
20
|
+
* - Each process runs one command at a time; requests go to an idle process, then
|
|
21
|
+
* to a new one while fewer than `maxProcesses` are alive (starting, busy,
|
|
22
|
+
* idle or still exiting), otherwise into one FIFO queue. Memory: O(queued
|
|
23
|
+
* requests) plus at most `maxResponseBytes` and `maxStderrBytes` per running
|
|
24
|
+
* request.
|
|
25
|
+
* - A request's file is resolved and inspected once the request holds a process,
|
|
26
|
+
* so at most `maxProcesses` files are open for inspection, and inspection
|
|
27
|
+
* counts toward `requestTimeoutMs`, stops on cancellation and is awaited by
|
|
28
|
+
* `close()`.
|
|
29
|
+
* - A response is checked before its process takes the next request; a process
|
|
30
|
+
* that answered garbage is killed, never reused.
|
|
31
|
+
* - A process that exits during a request rejects that request with
|
|
32
|
+
* `ExiftoolProcessError`, without retry (the file may be what kills it);
|
|
33
|
+
* queued requests are unaffected and a fresh process starts for the next. A
|
|
34
|
+
* spawn failure rejects only the request that triggered it.
|
|
35
|
+
* - A process is replaced after `maxRequestsPerProcess` commands, and closed
|
|
36
|
+
* after `idleTimeoutMs` without work.
|
|
37
|
+
* - Exiftool never exits on end of input, so the pool kills its processes
|
|
38
|
+
* (SIGKILL) if Node exits without `close()`, through one shared
|
|
39
|
+
* `process.on("exit")` listener present only while a process lives; a process
|
|
40
|
+
* is registered the moment it is spawned. A parent killed outright (SIGKILL,
|
|
41
|
+
* or a signal Node does not handle) still leaves them running: call `close()`
|
|
42
|
+
* on shutdown, for instance from `@ac-kit/app-system`'s
|
|
43
|
+
* `watchShutdownSignals`.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* await using pool = new ExiftoolPool({ maxProcesses: 2 });
|
|
48
|
+
* const { tags } = await pool.readMetadata("photo.jpg", {
|
|
49
|
+
* tags: ["EXIF:DateTimeOriginal", "Orientation"],
|
|
50
|
+
* });
|
|
51
|
+
* ```;
|
|
52
|
+
*/
|
|
53
|
+
export class ExiftoolPool {
|
|
54
|
+
config;
|
|
55
|
+
maxProcesses;
|
|
56
|
+
maxRequestsPerProcess;
|
|
57
|
+
requestTimeoutMs;
|
|
58
|
+
idleTimeoutMs;
|
|
59
|
+
queue = new DoublyLinkedList();
|
|
60
|
+
/** Started and in service, busy or idle. */
|
|
61
|
+
workers = new Set();
|
|
62
|
+
idle = [];
|
|
63
|
+
idleTimers = new Map();
|
|
64
|
+
/** Every started process that has not exited yet, retiring ones included. */
|
|
65
|
+
alive = new Set();
|
|
66
|
+
/** Requests holding or acquiring a process. */
|
|
67
|
+
active = new Set();
|
|
68
|
+
starting = 0;
|
|
69
|
+
closing = null;
|
|
70
|
+
drained = Promise.withResolvers();
|
|
71
|
+
/**
|
|
72
|
+
* @param options See {@link ExiftoolPoolOptions}.
|
|
73
|
+
* @throws {RangeError} For a count that is not a positive integer (or
|
|
74
|
+
* `Infinity` where allowed), or a duration outside its range.
|
|
75
|
+
*/
|
|
76
|
+
constructor(options) {
|
|
77
|
+
this.maxProcesses = checkCount_("maxProcesses", options?.maxProcesses ?? 1, false);
|
|
78
|
+
this.maxRequestsPerProcess = checkCount_("maxRequestsPerProcess", options?.maxRequestsPerProcess ?? 1000, true);
|
|
79
|
+
this.requestTimeoutMs = checkDuration_("requestTimeoutMs", options?.requestTimeoutMs ?? 60000);
|
|
80
|
+
this.idleTimeoutMs = checkDuration_("idleTimeoutMs", options?.idleTimeoutMs ?? 2000);
|
|
81
|
+
const graceMs = options?.shutdownGraceMs ?? 5000;
|
|
82
|
+
if (!Number.isInteger(graceMs) || graceMs < 0 || graceMs > MAX_TIMER_MS_) {
|
|
83
|
+
throw new RangeError(`shutdownGraceMs must be an integer from 0 to ${MAX_TIMER_MS_}: ${graceMs}`);
|
|
84
|
+
}
|
|
85
|
+
this.config = {
|
|
86
|
+
command: options?.command ?? "exiftool",
|
|
87
|
+
leadingArgs: [
|
|
88
|
+
...(options?.commandArgs ?? []),
|
|
89
|
+
"-config",
|
|
90
|
+
options?.configFile ?? "",
|
|
91
|
+
],
|
|
92
|
+
cwd: options?.cwd ?? null,
|
|
93
|
+
env: options?.env ?? null,
|
|
94
|
+
maxResponseBytes: checkCount_("maxResponseBytes", options?.maxResponseBytes ?? DEFAULT_MAX_RESPONSE_BYTES_, false),
|
|
95
|
+
maxStderrBytes: checkCount_("maxStderrBytes", options?.maxStderrBytes ?? DEFAULT_MAX_STDERR_BYTES_, false),
|
|
96
|
+
graceMs,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/** Whether {@link close} has been called. */
|
|
100
|
+
get closed() {
|
|
101
|
+
return this.closing !== null;
|
|
102
|
+
}
|
|
103
|
+
async readMetadata(path, options) {
|
|
104
|
+
const before = printReadArguments(options);
|
|
105
|
+
// Refuses an unusable path at once; the resolved one is checked again.
|
|
106
|
+
printPathArgument(path);
|
|
107
|
+
const scalars = options?.scalars ?? "json";
|
|
108
|
+
const groups = options?.groups ?? [1];
|
|
109
|
+
const maxResponseBytes = this.config.maxResponseBytes;
|
|
110
|
+
const cwd = this.config.cwd ?? process.cwd();
|
|
111
|
+
const prepare = async (signal) => {
|
|
112
|
+
const resolved = await inspectFile(path, cwd, signal);
|
|
113
|
+
const { line, operand } = printPathArgument(resolved);
|
|
114
|
+
return {
|
|
115
|
+
before,
|
|
116
|
+
after: [line],
|
|
117
|
+
interpret: (_worker, response) => {
|
|
118
|
+
const result = response;
|
|
119
|
+
if (result.stdoutBytes > maxResponseBytes) {
|
|
120
|
+
throw new ExiftoolLimitError("response-bytes", maxResponseBytes, result.stdoutBytes);
|
|
121
|
+
}
|
|
122
|
+
const entries = parseJsonOutput(result.stdout, scalars);
|
|
123
|
+
if (entries.length !== 1) {
|
|
124
|
+
throw new ExiftoolCommandError(result.status, result.stderr, entries.length === 0
|
|
125
|
+
? undefined
|
|
126
|
+
: `exiftool returned ${entries.length} entries for one path`);
|
|
127
|
+
}
|
|
128
|
+
const { SourceFile: sourceFile, ...tags } = entries[0];
|
|
129
|
+
if (!isSameOperand_(sourceFile, operand)) {
|
|
130
|
+
throw new ExiftoolOutputError(`exiftool read ${JSON.stringify(sourceFile)} instead of ${JSON.stringify(operand)}`);
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
sourceFile: path,
|
|
134
|
+
tags,
|
|
135
|
+
error: findExiftoolMessage(tags, "Error", groups),
|
|
136
|
+
warning: findExiftoolMessage(tags, "Warning", groups),
|
|
137
|
+
stderr: result.stderr,
|
|
138
|
+
};
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
return (await this.submit(prepare, scalars === "text" ? EXIFTOOL_TEXT_SCALARS_VERSION : null, options?.signal ?? null));
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The version of the program, starting a process if none is running.
|
|
146
|
+
*
|
|
147
|
+
* @param signal Aborts the wait (and a process being started for it).
|
|
148
|
+
* @throws As {@link readMetadata} does for spawning and closing.
|
|
149
|
+
*/
|
|
150
|
+
async getVersion(signal) {
|
|
151
|
+
for (const worker of this.workers) {
|
|
152
|
+
return worker.version;
|
|
153
|
+
}
|
|
154
|
+
return (await this.submit(() => Promise.resolve({
|
|
155
|
+
before: null,
|
|
156
|
+
after: [],
|
|
157
|
+
interpret: (worker) => worker.version,
|
|
158
|
+
}), null, signal ?? null));
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Closes the pool. Idempotent.
|
|
162
|
+
*
|
|
163
|
+
* - Queued requests reject with {@link ExiftoolPoolClosedError}.
|
|
164
|
+
* - Running requests, and requests waiting for a new process, finish unless
|
|
165
|
+
* `signal` aborts, which rejects them with its reason and terminates their
|
|
166
|
+
* processes.
|
|
167
|
+
* - Each process is sent `-stay_open False` and given `shutdownGraceMs` to
|
|
168
|
+
* exit, then terminated.
|
|
169
|
+
*
|
|
170
|
+
* @returns Resolves once every process has exited; never rejects.
|
|
171
|
+
*/
|
|
172
|
+
close(signal) {
|
|
173
|
+
if (this.closing === null) {
|
|
174
|
+
this.closing = this.drained.promise;
|
|
175
|
+
let request = this.queue.popFront();
|
|
176
|
+
while (request !== undefined) {
|
|
177
|
+
this.settle(request, new ExiftoolPoolClosedError());
|
|
178
|
+
request = this.queue.popFront();
|
|
179
|
+
}
|
|
180
|
+
// Copied: retiring removes the worker from the list being walked.
|
|
181
|
+
for (const worker of this.idle.slice()) {
|
|
182
|
+
this.retire(worker, false);
|
|
183
|
+
}
|
|
184
|
+
this.checkDrained();
|
|
185
|
+
}
|
|
186
|
+
if (signal) {
|
|
187
|
+
const abortActive = () => {
|
|
188
|
+
// Copied: cancelling removes the request from the set being walked.
|
|
189
|
+
for (const request of Array.from(this.active)) {
|
|
190
|
+
this.cancelRequest(request, signal.reason);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
if (signal.aborted) {
|
|
194
|
+
abortActive();
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
signal.addEventListener("abort", abortActive, { once: true });
|
|
198
|
+
void this.closing.then(() => signal.removeEventListener("abort", abortActive));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return this.closing;
|
|
202
|
+
}
|
|
203
|
+
async [Symbol.asyncDispose]() {
|
|
204
|
+
await this.close();
|
|
205
|
+
}
|
|
206
|
+
submit(prepare, minimumVersion, signal) {
|
|
207
|
+
if (this.closing !== null) {
|
|
208
|
+
return Promise.reject(new ExiftoolPoolClosedError());
|
|
209
|
+
}
|
|
210
|
+
if (signal?.aborted === true) {
|
|
211
|
+
return Promise.reject(signal.reason);
|
|
212
|
+
}
|
|
213
|
+
const { promise, resolve, reject } = Promise.withResolvers();
|
|
214
|
+
const request = {
|
|
215
|
+
prepare,
|
|
216
|
+
minimumVersion,
|
|
217
|
+
state: "queued",
|
|
218
|
+
cursor: null,
|
|
219
|
+
worker: null,
|
|
220
|
+
cancel: new AbortController(),
|
|
221
|
+
settled: new AbortController(),
|
|
222
|
+
resolve,
|
|
223
|
+
reject,
|
|
224
|
+
};
|
|
225
|
+
signal?.addEventListener("abort", () => request.cancel.abort(signal.reason), { once: true, signal: request.settled.signal });
|
|
226
|
+
request.cancel.signal.addEventListener("abort", () => this.cancelRequest(request, request.cancel.signal.reason), { once: true, signal: request.settled.signal });
|
|
227
|
+
this.queue.pushBack(request);
|
|
228
|
+
const cursor = this.queue.end();
|
|
229
|
+
cursor.retreat();
|
|
230
|
+
request.cursor = cursor;
|
|
231
|
+
this.dispatch();
|
|
232
|
+
return promise;
|
|
233
|
+
}
|
|
234
|
+
dispatch() {
|
|
235
|
+
while (this.closing === null && this.queue.count() > 0) {
|
|
236
|
+
const worker = this.idle.pop();
|
|
237
|
+
if (worker !== undefined) {
|
|
238
|
+
this.assign(this.queue.popFront(), worker);
|
|
239
|
+
}
|
|
240
|
+
else if (this.alive.size + this.starting < this.maxProcesses) {
|
|
241
|
+
this.startFor(this.queue.popFront());
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
armTimeout(request) {
|
|
249
|
+
setLongTimeout(() => request.cancel.abort(new DOMException(`exiftool request timed out after ${this.requestTimeoutMs} ms`, "TimeoutError")), this.requestTimeoutMs, request.settled.signal);
|
|
250
|
+
}
|
|
251
|
+
startFor(request) {
|
|
252
|
+
request.state = "starting";
|
|
253
|
+
request.cursor = null;
|
|
254
|
+
this.active.add(request);
|
|
255
|
+
this.starting++;
|
|
256
|
+
this.armTimeout(request);
|
|
257
|
+
ExiftoolWorker.start(this.config, request.cancel.signal).then((worker) => {
|
|
258
|
+
this.starting--;
|
|
259
|
+
this.workers.add(worker);
|
|
260
|
+
this.alive.add(worker);
|
|
261
|
+
worker.onExited((exited) => this.onWorkerExited(exited));
|
|
262
|
+
// A request cancelled meanwhile (its signal, the timeout, a close
|
|
263
|
+
// signal) never gets the process.
|
|
264
|
+
if (request.state === "starting") {
|
|
265
|
+
this.assign(request, worker);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
this.release(worker);
|
|
269
|
+
}
|
|
270
|
+
}, (error) => {
|
|
271
|
+
this.starting--;
|
|
272
|
+
this.settle(request, error);
|
|
273
|
+
this.checkDrained();
|
|
274
|
+
this.dispatch();
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
assign(request, worker) {
|
|
278
|
+
this.idleTimers.get(worker)?.abort();
|
|
279
|
+
this.idleTimers.delete(worker);
|
|
280
|
+
if (request.state === "queued") {
|
|
281
|
+
this.armTimeout(request);
|
|
282
|
+
}
|
|
283
|
+
request.state = "preparing";
|
|
284
|
+
request.cursor = null;
|
|
285
|
+
request.worker = worker;
|
|
286
|
+
this.active.add(request);
|
|
287
|
+
const minimum = request.minimumVersion;
|
|
288
|
+
if (minimum !== null &&
|
|
289
|
+
compareExiftoolVersions(worker.version, minimum) < 0) {
|
|
290
|
+
this.settle(request, new ExiftoolVersionError(worker.version, minimum));
|
|
291
|
+
this.release(worker);
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
request.prepare(request.cancel.signal).then((prepared) => {
|
|
295
|
+
if (request.state === "settled") {
|
|
296
|
+
this.release(worker);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
request.state = "running";
|
|
300
|
+
if (prepared.before === null) {
|
|
301
|
+
this.finish(request, worker, prepared.interpret, null);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
worker.run(prepared.before, prepared.after).then((response) => this.finish(request, worker, prepared.interpret, response), (error) => {
|
|
305
|
+
this.settle(request, error);
|
|
306
|
+
this.release(worker);
|
|
307
|
+
});
|
|
308
|
+
}, (error) => {
|
|
309
|
+
this.settle(request, error);
|
|
310
|
+
this.release(worker);
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
/** Interprets a response, then hands the process back or retires it. */
|
|
314
|
+
finish(request, worker, interpret, response) {
|
|
315
|
+
if (request.state === "settled") {
|
|
316
|
+
this.release(worker);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
let value;
|
|
320
|
+
try {
|
|
321
|
+
value = interpret(worker, response);
|
|
322
|
+
}
|
|
323
|
+
catch (error) {
|
|
324
|
+
this.settle(request, error);
|
|
325
|
+
if (error instanceof ExiftoolOutputError) {
|
|
326
|
+
this.retire(worker, true);
|
|
327
|
+
this.dispatch();
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
this.release(worker);
|
|
331
|
+
}
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
this.fulfil(request, value);
|
|
335
|
+
this.release(worker);
|
|
336
|
+
}
|
|
337
|
+
release(worker) {
|
|
338
|
+
if (worker.retired || !this.workers.has(worker)) {
|
|
339
|
+
this.dispatch();
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
if (this.closing !== null ||
|
|
343
|
+
worker.requestCount >= this.maxRequestsPerProcess) {
|
|
344
|
+
this.retire(worker, false);
|
|
345
|
+
this.dispatch();
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
this.idle.push(worker);
|
|
349
|
+
this.dispatch();
|
|
350
|
+
if (this.idle.includes(worker) && Number.isFinite(this.idleTimeoutMs)) {
|
|
351
|
+
const timer = new AbortController();
|
|
352
|
+
this.idleTimers.set(worker, timer);
|
|
353
|
+
setLongTimeout(() => this.retire(worker, false), this.idleTimeoutMs, timer.signal);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Takes a process out of service, gracefully or by terminating it. It still
|
|
358
|
+
* counts against `maxProcesses` until it has exited.
|
|
359
|
+
*/
|
|
360
|
+
retire(worker, terminate) {
|
|
361
|
+
this.workers.delete(worker);
|
|
362
|
+
const idleIndex = this.idle.indexOf(worker);
|
|
363
|
+
if (idleIndex !== -1) {
|
|
364
|
+
this.idle.splice(idleIndex, 1);
|
|
365
|
+
}
|
|
366
|
+
this.idleTimers.get(worker)?.abort();
|
|
367
|
+
this.idleTimers.delete(worker);
|
|
368
|
+
(terminate ? worker.terminate() : worker.close()).catch(() => {
|
|
369
|
+
// The exit listener settles the pool whatever the shutdown did.
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
onWorkerExited(worker) {
|
|
373
|
+
this.retire(worker, false);
|
|
374
|
+
this.alive.delete(worker);
|
|
375
|
+
this.checkDrained();
|
|
376
|
+
this.dispatch();
|
|
377
|
+
}
|
|
378
|
+
cancelRequest(request, reason) {
|
|
379
|
+
switch (request.state) {
|
|
380
|
+
case "queued":
|
|
381
|
+
if (request.cursor?.valid === true) {
|
|
382
|
+
this.queue.removeAt(request.cursor);
|
|
383
|
+
}
|
|
384
|
+
this.settle(request, reason);
|
|
385
|
+
break;
|
|
386
|
+
case "starting":
|
|
387
|
+
case "preparing":
|
|
388
|
+
this.settle(request, reason);
|
|
389
|
+
// Stops the start (terminating its process) or the inspection (the
|
|
390
|
+
// process is kept); a no-op when this abort is what got here.
|
|
391
|
+
request.cancel.abort(reason);
|
|
392
|
+
break;
|
|
393
|
+
case "running": {
|
|
394
|
+
const worker = request.worker;
|
|
395
|
+
this.settle(request, reason);
|
|
396
|
+
this.retire(worker, true);
|
|
397
|
+
this.dispatch();
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
case "settled":
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
/** Rejects a request that has not settled yet. */
|
|
405
|
+
settle(request, error) {
|
|
406
|
+
if (this.markSettled(request)) {
|
|
407
|
+
request.reject(error);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
/** Resolves a request that has not settled yet. */
|
|
411
|
+
fulfil(request, value) {
|
|
412
|
+
if (this.markSettled(request)) {
|
|
413
|
+
request.resolve(value);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
markSettled(request) {
|
|
417
|
+
if (request.state === "settled") {
|
|
418
|
+
return false;
|
|
419
|
+
}
|
|
420
|
+
request.state = "settled";
|
|
421
|
+
request.cursor = null;
|
|
422
|
+
request.settled.abort();
|
|
423
|
+
this.active.delete(request);
|
|
424
|
+
return true;
|
|
425
|
+
}
|
|
426
|
+
checkDrained() {
|
|
427
|
+
if (this.closing !== null && this.starting === 0 && this.alive.size === 0) {
|
|
428
|
+
this.drained.resolve();
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
/** Exiftool prints Windows paths with forward slashes. */
|
|
433
|
+
function isSameOperand_(sourceFile, operand) {
|
|
434
|
+
if (process.platform === "win32") {
|
|
435
|
+
return (win32.normalize(sourceFile).toLowerCase() ===
|
|
436
|
+
win32.normalize(operand).toLowerCase());
|
|
437
|
+
}
|
|
438
|
+
return sourceFile === operand;
|
|
439
|
+
}
|
|
440
|
+
function checkCount_(name, value, allowInfinity) {
|
|
441
|
+
if ((allowInfinity && value === Number.POSITIVE_INFINITY) ||
|
|
442
|
+
(Number.isSafeInteger(value) && value >= 1)) {
|
|
443
|
+
return value;
|
|
444
|
+
}
|
|
445
|
+
throw new RangeError(`${name} must be an integer ≥ 1${allowInfinity ? " or Infinity" : ""}: ${value}`);
|
|
446
|
+
}
|
|
447
|
+
/** For durations handed to `setLongTimeout`, which waits any length. */
|
|
448
|
+
function checkDuration_(name, value) {
|
|
449
|
+
if (value === Number.POSITIVE_INFINITY ||
|
|
450
|
+
(Number.isFinite(value) && value >= 0)) {
|
|
451
|
+
return value;
|
|
452
|
+
}
|
|
453
|
+
throw new RangeError(`${name} must be ≥ 0 or Infinity: ${value}`);
|
|
454
|
+
}
|
|
455
|
+
//# sourceMappingURL=exiftool-pool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exiftool-pool.js","sourceRoot":"","sources":["../src/exiftool-pool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAA+B,MAAM,cAAc,CAAC;AAE7E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,eAA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AAC1D,SAAS,cAAc,CAAC,UAAkB,EAAE,OAAe;IAC1D,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QAClC,OAAO,CACN,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE;YACzC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CACtC,CAAC;IACH,CAAC;IACD,OAAO,UAAU,KAAK,OAAO,CAAC;AAC/B,CAAC;AAED,SAAS,WAAW,CACnB,IAAY,EACZ,KAAa,EACb,aAAsB;IAEtB,IACC,CAAC,aAAa,IAAI,KAAK,KAAK,MAAM,CAAC,iBAAiB,CAAC;QACrD,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,EAC1C,CAAC;QACF,OAAO,KAAK,CAAC;IACd,CAAC;IACD,MAAM,IAAI,UAAU,CACnB,GAAG,IAAI,0BAA0B,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,EAAE,CAChF,CAAC;AACH,CAAC;AAED,wEAAwE;AACxE,SAAS,cAAc,CAAC,IAAY,EAAE,KAAa;IAClD,IACC,KAAK,KAAK,MAAM,CAAC,iBAAiB;QAClC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,EACrC,CAAC;QACF,OAAO,KAAK,CAAC;IACd,CAAC;IACD,MAAM,IAAI,UAAU,CAAC,GAAG,IAAI,6BAA6B,KAAK,EAAE,CAAC,CAAC;AACnE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./date-time.js";
|
|
2
|
+
export * from "./errors.js";
|
|
3
|
+
export * from "./exiftool-pool.js";
|
|
4
|
+
export * from "./metadata.js";
|
|
5
|
+
export * from "./read-options.js";
|
|
6
|
+
export { EXIFTOOL_MINIMUM_VERSION, EXIFTOOL_TEXT_SCALARS_VERSION, type ExiftoolVersion, parseExiftoolVersion, } from "./version.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EACN,wBAAwB,EACxB,6BAA6B,EAC7B,KAAK,eAAe,EACpB,oBAAoB,GACpB,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./date-time.js";
|
|
2
|
+
export * from "./errors.js";
|
|
3
|
+
export * from "./exiftool-pool.js";
|
|
4
|
+
export * from "./metadata.js";
|
|
5
|
+
export * from "./read-options.js";
|
|
6
|
+
export { EXIFTOOL_MINIMUM_VERSION, EXIFTOOL_TEXT_SCALARS_VERSION, parseExiftoolVersion, } from "./version.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EACN,wBAAwB,EACxB,6BAA6B,EAE7B,oBAAoB,GACpB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** A leaf value in exiftool's JSON output. */
|
|
2
|
+
export type ExiftoolScalar = string | number | boolean;
|
|
3
|
+
/**
|
|
4
|
+
* A tag value: a scalar, a list (`XMP-dc:Subject`), or a structure (with
|
|
5
|
+
* `struct: true`).
|
|
6
|
+
*
|
|
7
|
+
* @template TScalar `string` when the read asked for `scalars: "text"`.
|
|
8
|
+
*/
|
|
9
|
+
export type ExiftoolValue<TScalar = ExiftoolScalar> = TScalar | readonly ExiftoolValue<TScalar>[] | {
|
|
10
|
+
readonly [field: string]: ExiftoolValue<TScalar>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* One file's metadata, as one exiftool `-json` entry.
|
|
14
|
+
*
|
|
15
|
+
* @template TScalar `string` when the read asked for `scalars: "text"`.
|
|
16
|
+
*/
|
|
17
|
+
export type ExiftoolMetadata<TScalar = ExiftoolScalar> = {
|
|
18
|
+
/** The path as the caller gave it, not exiftool's spelling of it. */
|
|
19
|
+
readonly sourceFile: string;
|
|
20
|
+
/**
|
|
21
|
+
* Every tag, keyed exactly as exiftool printed it (`"IFD0:Make"` with the
|
|
22
|
+
* default `groups: [1]`), `SourceFile` removed. Own properties only, so a
|
|
23
|
+
* `__proto__` key is an ordinary entry.
|
|
24
|
+
*/
|
|
25
|
+
readonly tags: Readonly<Record<string, ExiftoolValue<TScalar>>>;
|
|
26
|
+
/**
|
|
27
|
+
* Exiftool's own `Error` tag (for instance `"Unknown file type"`), which also
|
|
28
|
+
* stays in `tags`; `null` when absent.
|
|
29
|
+
*/
|
|
30
|
+
readonly error: string | null;
|
|
31
|
+
/** Exiftool's own (first) `Warning` tag, which also stays in `tags`. */
|
|
32
|
+
readonly warning: string | null;
|
|
33
|
+
/**
|
|
34
|
+
* What exiftool printed to stderr for this request, capped at the pool's
|
|
35
|
+
* `maxStderrBytes` (the first bytes are kept).
|
|
36
|
+
*/
|
|
37
|
+
readonly stderr: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* How deeply arrays and objects may nest in one response. exiftool's structures
|
|
41
|
+
* stay a few levels deep; a deeper response (a hostile file through `struct:
|
|
42
|
+
* true`) rejects with `ExiftoolLimitError` of kind `"nesting-depth"` instead of
|
|
43
|
+
* exhausting the stack.
|
|
44
|
+
*/
|
|
45
|
+
export declare const EXIFTOOL_MAX_JSON_DEPTH = 256;
|
|
46
|
+
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,MAAM,aAAa,CAAC,OAAO,GAAG,cAAc,IAC/C,OAAO,GACP,SAAS,aAAa,CAAC,OAAO,CAAC,EAAE,GACjC;IAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC;AAExD;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,OAAO,GAAG,cAAc,IAAI;IACxD,qEAAqE;IACrE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAEhE;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,MAAM,CAAC"}
|
package/dist/metadata.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How deeply arrays and objects may nest in one response. exiftool's structures
|
|
3
|
+
* stay a few levels deep; a deeper response (a hostile file through `struct:
|
|
4
|
+
* true`) rejects with `ExiftoolLimitError` of kind `"nesting-depth"` instead of
|
|
5
|
+
* exhausting the stack.
|
|
6
|
+
*/
|
|
7
|
+
export const EXIFTOOL_MAX_JSON_DEPTH = 256;
|
|
8
|
+
//# sourceMappingURL=metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AA8CA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An exiftool group family (`-G<family>`): 0 is the information type (`EXIF`,
|
|
3
|
+
* `XMP`), 1 the specific location (`IFD0`, `ExifIFD`, `XMP-dc`), 2 the category
|
|
4
|
+
* (`Camera`, `Time`); see exiftool's documentation for 3 to 8.
|
|
5
|
+
*/
|
|
6
|
+
export type ExiftoolGroupFamily = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
7
|
+
/** What one `readMetadata` call asks exiftool for. */
|
|
8
|
+
export type ExiftoolReadOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* Aborting removes a queued request, or terminates the process running it (a
|
|
11
|
+
* new one starts on demand).
|
|
12
|
+
*/
|
|
13
|
+
readonly signal?: AbortSignal | null;
|
|
14
|
+
/**
|
|
15
|
+
* The group families each key is prefixed with (`-G1`, `-G0:1`). Default
|
|
16
|
+
* `[1]`, giving keys such as `IFD0:Make` and `XMP-dc:Title`; `[]` gives bare
|
|
17
|
+
* tag names, which collide when two groups carry the same tag. Distinct
|
|
18
|
+
* values only.
|
|
19
|
+
*/
|
|
20
|
+
readonly groups?: readonly ExiftoolGroupFamily[] | null;
|
|
21
|
+
/**
|
|
22
|
+
* Default `false` (exiftool's `-n`): machine values, such as `Orientation`
|
|
23
|
+
* `6`, signed decimal GPS coordinates, durations in seconds. `true` gives
|
|
24
|
+
* exiftool's printed English values instead (`"Rotate 90 CW"`), which vary
|
|
25
|
+
* between versions.
|
|
26
|
+
*/
|
|
27
|
+
readonly printConversion?: boolean | null;
|
|
28
|
+
/**
|
|
29
|
+
* How scalars come back.
|
|
30
|
+
*
|
|
31
|
+
* - `"json"` (default): as exiftool typed them in its JSON. Text reading
|
|
32
|
+
* `true`/`false` (any case) becomes a boolean; text that looks like a
|
|
33
|
+
* number (at most 15 integer, 16 fraction and 3 exponent digits) becomes a
|
|
34
|
+
* number, so `"1.50"` reads as `1.5` and `"0012"` stays a string. A number
|
|
35
|
+
* beyond the double range comes back as its text rather than `Infinity`.
|
|
36
|
+
* - `"text"`: every scalar is the exact text exiftool printed, through `-api
|
|
37
|
+
* StructFormat=JSONQ`. Needs exiftool 13.00 or newer
|
|
38
|
+
* (`EXIFTOOL_TEXT_SCALARS_VERSION`), the first to quote every value; older
|
|
39
|
+
* ones reject the read with `ExiftoolVersionError`.
|
|
40
|
+
*/
|
|
41
|
+
readonly scalars?: "json" | "text" | null;
|
|
42
|
+
/**
|
|
43
|
+
* Tags to extract, as exiftool names them, without the dash: `Make`,
|
|
44
|
+
* `EXIF:DateTimeOriginal`, `XMP-dc:all`, `1IPTC:City`, `Orientation#` (raw
|
|
45
|
+
* value for one tag), `GPS*`. Default: every tag.
|
|
46
|
+
*
|
|
47
|
+
* Each must match `(<group>:)*<name>[#]` with group names of letters, digits,
|
|
48
|
+
* `_` and `-` (an optional leading family digit), and names that may also use
|
|
49
|
+
* `?` and `*`. Every selector is sent as `-All:<selector>`, so none can ever
|
|
50
|
+
* be read as an exiftool option.
|
|
51
|
+
*/
|
|
52
|
+
readonly tags?: readonly string[] | null;
|
|
53
|
+
/** Tags to leave out (`--TAG`), in the same syntax as `tags`. */
|
|
54
|
+
readonly excludeTags?: readonly string[] | null;
|
|
55
|
+
/** `-struct`: XMP structures as JSON objects rather than flattened tags. */
|
|
56
|
+
readonly struct?: boolean | null;
|
|
57
|
+
/**
|
|
58
|
+
* `-ee[N]`: metadata embedded in the file's data, such as timed GPS in
|
|
59
|
+
* videos. 1 to 3 dig deeper; 0 or `null` turns it off (default).
|
|
60
|
+
*/
|
|
61
|
+
readonly extractEmbedded?: 0 | 1 | 2 | 3 | null;
|
|
62
|
+
/** `-u` (1) or `-U` (2): unknown tags too. Default off. */
|
|
63
|
+
readonly unknown?: 0 | 1 | 2 | null;
|
|
64
|
+
/** `-fast[N]`: stop reading earlier, at the cost of some tags. Default off. */
|
|
65
|
+
readonly fast?: 0 | 1 | 2 | 3 | 4 | 5 | null;
|
|
66
|
+
/**
|
|
67
|
+
* `-api name=value` pairs. Only options that change what a read reports, and
|
|
68
|
+
* never run code, write files or outlive the request, are accepted
|
|
69
|
+
* (case-insensitively): `ByteUnit`, `CharsetEXIF`, `CharsetID3`,
|
|
70
|
+
* `CharsetIPTC`, `CharsetPhotoshop`, `CharsetQuickTime`, `CharsetRIFF`,
|
|
71
|
+
* `Composite`, `DateFormat`, `Duplicates`, `GPSQuadrant`, `HexTagIDs`,
|
|
72
|
+
* `IgnoreGroups`, `IgnoreMinorErrors`, `IgnoreTags`, `ImageHashType`,
|
|
73
|
+
* `KeepUTCTime`, `LargeFileSupport`, `LimitLongValues`, `MissingTagValue`,
|
|
74
|
+
* `NoPDFList`, `QuickTimeHandler`, `QuickTimeUTC`, `RequestAll`,
|
|
75
|
+
* `RequestTags`, `ScanForXMP`, `StrictDate`, `SystemTags`, `SystemTimeRes`,
|
|
76
|
+
* `Validate`, `WindowsLongPath`, `WindowsWideFile`, `XMPAutoConv`.
|
|
77
|
+
*
|
|
78
|
+
* Refused among others: `Password` (no decryption), `Filter`/`FilterW` (Perl
|
|
79
|
+
* expressions), `TextOut`/`Verbose`/`HtmlDump` (output files), `TimeZone`
|
|
80
|
+
* (changes the process environment), and options this type sets itself
|
|
81
|
+
* (`StructFormat`, `PrintConv`, `Struct`, `Unknown`, `ExtractEmbedded`,
|
|
82
|
+
* `FastScan`).
|
|
83
|
+
*/
|
|
84
|
+
readonly api?: readonly (readonly [name: string, value: string])[] | null;
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=read-options.d.ts.map
|
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