@wasmedia/wexiftool 0.0.0-stage → 0.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/LICENSE +21 -0
- package/LICENSE-exiftool +19 -0
- package/README.md +105 -2
- package/dist/cli.cjs +19 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.es.js +81 -0
- package/dist/index-B49L_wsJ.cjs +1 -0
- package/dist/index-D8B3sucz.js +681 -0
- package/dist/node-CRF3Yhkk.cjs +1 -0
- package/dist/node-P4tq-yoT.js +102 -0
- package/dist/wexiftool-CL0NBE7L.js +761 -0
- package/dist/wexiftool-DICKi0_a.cjs +4 -0
- package/dist/wexiftool.cjs +1 -0
- package/dist/wexiftool.d.ts +255 -0
- package/dist/wexiftool.es.js +5 -0
- package/dist/worker.cjs +1 -0
- package/dist/worker.d.ts +1 -0
- package/dist/worker.es.js +64 -0
- package/package.json +69 -4
- package/wasm/package.json +4 -0
- package/wasm/perl.js +2 -0
- package/wasm/perl.wasm +4 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as E from "node:fs";
|
|
2
|
+
import * as O from "node:path";
|
|
3
|
+
import { a as f, g as I } from "./wexiftool-CL0NBE7L.js";
|
|
4
|
+
import { r as P, M as W, b as z, i as B, S as M } from "./index-D8B3sucz.js";
|
|
5
|
+
const { closeSync: N, existsSync: j, fstatSync: k, ftruncateSync: A, mkdirSync: S, openSync: g, readSync: J, realpathSync: $, renameSync: b, rmSync: q, writeFileSync: C, writeSync: G } = E, { dirname: p, isAbsolute: H, join: h, relative: K, resolve: x, sep: L } = O;
|
|
6
|
+
function v(e) {
|
|
7
|
+
let t = !1;
|
|
8
|
+
return {
|
|
9
|
+
read: (n, i) => J(e, n, 0, n.length, i),
|
|
10
|
+
write: (n, i) => {
|
|
11
|
+
let s = 0;
|
|
12
|
+
for (; s < n.length; )
|
|
13
|
+
s += G(e, n, s, n.length - s, i + s);
|
|
14
|
+
return s;
|
|
15
|
+
},
|
|
16
|
+
truncate: (n) => A(e, n),
|
|
17
|
+
getSize: () => k(e).size,
|
|
18
|
+
flush: () => {
|
|
19
|
+
},
|
|
20
|
+
close: () => {
|
|
21
|
+
t || (t = !0, N(e));
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function D(e, t, n, i = !1) {
|
|
26
|
+
const s = K(x(e), t);
|
|
27
|
+
if (!s && !i || s === ".." || s.startsWith(`..${L}`) || H(s))
|
|
28
|
+
throw new I(`refusing to commit ${JSON.stringify(n)}: it resolves outside outputDir`);
|
|
29
|
+
}
|
|
30
|
+
async function T(e) {
|
|
31
|
+
const t = e.outputDir;
|
|
32
|
+
if (t !== void 0 && typeof t != "string")
|
|
33
|
+
throw new f("the node backend needs outputDir to be a host directory path");
|
|
34
|
+
if (t === void 0 && e.scratch > 0)
|
|
35
|
+
throw new f(`scratch (${e.scratch}) needs outputDir: without it the mount is input-only`);
|
|
36
|
+
const n = [], i = t === void 0 ? "" : h(t, `.wopfs-scratch-${P()}`);
|
|
37
|
+
let s = !1, F = 0;
|
|
38
|
+
const d = async () => {
|
|
39
|
+
for (const a of n)
|
|
40
|
+
try {
|
|
41
|
+
a.close();
|
|
42
|
+
} catch {
|
|
43
|
+
}
|
|
44
|
+
s && q(i, { recursive: !0, force: !0 });
|
|
45
|
+
};
|
|
46
|
+
try {
|
|
47
|
+
const a = [];
|
|
48
|
+
for (const [r, o] of e.inputs)
|
|
49
|
+
if (typeof o == "string") {
|
|
50
|
+
let u;
|
|
51
|
+
try {
|
|
52
|
+
u = g(o, "r");
|
|
53
|
+
} catch (l) {
|
|
54
|
+
throw new f(`input ${r}: cannot open ${o}: ${l.message}`, { cause: l });
|
|
55
|
+
}
|
|
56
|
+
const c = v(u);
|
|
57
|
+
if (n.push(c), !k(u).isFile())
|
|
58
|
+
throw new f(`input ${r}: ${o} is not a regular file`);
|
|
59
|
+
a.push({ path: r, file: c });
|
|
60
|
+
} else
|
|
61
|
+
a.push({ path: r, file: new W(await z(o, r, "node")) });
|
|
62
|
+
if (t === void 0)
|
|
63
|
+
return B("node", a, d);
|
|
64
|
+
S(i, { recursive: !0 }), s = !0;
|
|
65
|
+
const y = new M({
|
|
66
|
+
capacity: e.scratch,
|
|
67
|
+
onExhausted: e.onExhausted,
|
|
68
|
+
warn: e.warn,
|
|
69
|
+
open: (r) => {
|
|
70
|
+
const o = `s${r}`, u = v(g(h(i, o), "w+"));
|
|
71
|
+
return n.push(u), { name: o, file: u };
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return {
|
|
75
|
+
kind: "node",
|
|
76
|
+
inputs: a,
|
|
77
|
+
pool: y,
|
|
78
|
+
async commitFile(r, o, u) {
|
|
79
|
+
const c = x(t, ...r.split("/"));
|
|
80
|
+
D(t, c, r);
|
|
81
|
+
let l = p(c);
|
|
82
|
+
for (; !j(l); )
|
|
83
|
+
l = p(l);
|
|
84
|
+
D($(t), $(l), r, !0), S(p(c), { recursive: !0 });
|
|
85
|
+
const w = y.slotOf(o);
|
|
86
|
+
if (w)
|
|
87
|
+
o.close(), b(h(i, w.name), c);
|
|
88
|
+
else {
|
|
89
|
+
const m = h(i, `spill${F++}`);
|
|
90
|
+
C(m, o.bytes()), b(m, c);
|
|
91
|
+
}
|
|
92
|
+
return { path: r, size: u, hostPath: c };
|
|
93
|
+
},
|
|
94
|
+
release: d
|
|
95
|
+
};
|
|
96
|
+
} catch (a) {
|
|
97
|
+
throw await d(), a;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
T as openNodeBackend
|
|
102
|
+
};
|