opfs-worker 0.2.4 → 0.2.6
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/README.md +150 -35
- package/dist/assets/worker-CHy3JxL1.js.map +1 -0
- package/dist/{helpers-Co-qCBmA.js → helpers-C0nyU6hv.js} +56 -58
- package/dist/{helpers-Co-qCBmA.js.map → helpers-C0nyU6hv.js.map} +1 -1
- package/dist/helpers-FvdHLObV.cjs +2 -0
- package/dist/{helpers-hEpet7x7.cjs.map → helpers-FvdHLObV.cjs.map} +1 -1
- package/dist/index.cjs +472 -475
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +495 -495
- package/dist/index.js.map +1 -1
- package/dist/raw.cjs +1 -1
- package/dist/raw.cjs.map +1 -1
- package/dist/raw.js +166 -167
- package/dist/raw.js.map +1 -1
- package/dist/types.d.ts +12 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/helpers.d.ts +4 -2
- package/dist/utils/helpers.d.ts.map +1 -1
- package/dist/worker.d.ts +37 -61
- package/dist/worker.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/assets/worker-DCm4BiWM.js.map +0 -1
- package/dist/helpers-hEpet7x7.cjs +0 -2
package/dist/index.js
CHANGED
|
@@ -1,258 +1,258 @@
|
|
|
1
1
|
import { wrap as i, proxy as o } from "comlink";
|
|
2
|
-
import { D as d, F as
|
|
2
|
+
import { D as d, F as p, O as u, b as y, a as w, P as m, c as g, S as v, T as F, e as S, k as E, d as b, l as P, h as x, o as T, f as A, m as O, g as D, j as _, n as I, i as C, r as k, s as U, w as R } from "./helpers-C0nyU6hv.js";
|
|
3
3
|
const a = `/**
|
|
4
4
|
* @license
|
|
5
5
|
* Copyright 2019 Google LLC
|
|
6
6
|
* SPDX-License-Identifier: Apache-2.0
|
|
7
7
|
*/
|
|
8
|
-
const H = Symbol("Comlink.proxy"), R = Symbol("Comlink.endpoint"), B = Symbol("Comlink.releaseProxy"),
|
|
9
|
-
canHandle: (
|
|
10
|
-
serialize(
|
|
11
|
-
const { port1:
|
|
12
|
-
return
|
|
8
|
+
const H = Symbol("Comlink.proxy"), R = Symbol("Comlink.endpoint"), B = Symbol("Comlink.releaseProxy"), D = Symbol("Comlink.finalizer"), E = Symbol("Comlink.thrown"), $ = (e) => typeof e == "object" && e !== null || typeof e == "function", W = {
|
|
9
|
+
canHandle: (e) => $(e) && e[H],
|
|
10
|
+
serialize(e) {
|
|
11
|
+
const { port1: t, port2: r } = new MessageChannel();
|
|
12
|
+
return I(e, t), [r, [r]];
|
|
13
13
|
},
|
|
14
|
-
deserialize(
|
|
15
|
-
return
|
|
14
|
+
deserialize(e) {
|
|
15
|
+
return e.start(), Y(e);
|
|
16
16
|
}
|
|
17
17
|
}, j = {
|
|
18
|
-
canHandle: (
|
|
19
|
-
serialize({ value:
|
|
20
|
-
let
|
|
21
|
-
return
|
|
18
|
+
canHandle: (e) => $(e) && E in e,
|
|
19
|
+
serialize({ value: e }) {
|
|
20
|
+
let t;
|
|
21
|
+
return e instanceof Error ? t = {
|
|
22
22
|
isError: !0,
|
|
23
23
|
value: {
|
|
24
|
-
message:
|
|
25
|
-
name:
|
|
26
|
-
stack:
|
|
24
|
+
message: e.message,
|
|
25
|
+
name: e.name,
|
|
26
|
+
stack: e.stack
|
|
27
27
|
}
|
|
28
|
-
} :
|
|
28
|
+
} : t = { isError: !1, value: e }, [t, []];
|
|
29
29
|
},
|
|
30
|
-
deserialize(
|
|
31
|
-
throw
|
|
30
|
+
deserialize(e) {
|
|
31
|
+
throw e.isError ? Object.assign(new Error(e.value.message), e.value) : e.value;
|
|
32
32
|
}
|
|
33
|
-
},
|
|
33
|
+
}, z = /* @__PURE__ */ new Map([
|
|
34
34
|
["proxy", W],
|
|
35
35
|
["throw", j]
|
|
36
36
|
]);
|
|
37
|
-
function V(
|
|
38
|
-
for (const r of
|
|
39
|
-
if (
|
|
37
|
+
function V(e, t) {
|
|
38
|
+
for (const r of e)
|
|
39
|
+
if (t === r || r === "*" || r instanceof RegExp && r.test(t))
|
|
40
40
|
return !0;
|
|
41
41
|
return !1;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
if (!
|
|
43
|
+
function I(e, t = globalThis, r = ["*"]) {
|
|
44
|
+
t.addEventListener("message", function n(i) {
|
|
45
|
+
if (!i || !i.data)
|
|
46
46
|
return;
|
|
47
|
-
if (!V(r,
|
|
48
|
-
console.warn(\`Invalid origin '\${
|
|
47
|
+
if (!V(r, i.origin)) {
|
|
48
|
+
console.warn(\`Invalid origin '\${i.origin}' for comlink proxy\`);
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
|
-
const { id:
|
|
52
|
-
let
|
|
51
|
+
const { id: a, type: s, path: o } = Object.assign({ path: [] }, i.data), l = (i.data.argumentList || []).map(y);
|
|
52
|
+
let h;
|
|
53
53
|
try {
|
|
54
|
-
const
|
|
55
|
-
switch (
|
|
54
|
+
const u = o.slice(0, -1).reduce((f, g) => f[g], e), w = o.reduce((f, g) => f[g], e);
|
|
55
|
+
switch (s) {
|
|
56
56
|
case "GET":
|
|
57
|
-
|
|
57
|
+
h = w;
|
|
58
58
|
break;
|
|
59
59
|
case "SET":
|
|
60
|
-
|
|
60
|
+
u[o.slice(-1)[0]] = y(i.data.value), h = !0;
|
|
61
61
|
break;
|
|
62
62
|
case "APPLY":
|
|
63
|
-
|
|
63
|
+
h = w.apply(u, l);
|
|
64
64
|
break;
|
|
65
65
|
case "CONSTRUCT":
|
|
66
66
|
{
|
|
67
|
-
const
|
|
68
|
-
|
|
67
|
+
const f = new w(...l);
|
|
68
|
+
h = Q(f);
|
|
69
69
|
}
|
|
70
70
|
break;
|
|
71
71
|
case "ENDPOINT":
|
|
72
72
|
{
|
|
73
|
-
const { port1:
|
|
74
|
-
|
|
73
|
+
const { port1: f, port2: g } = new MessageChannel();
|
|
74
|
+
I(e, g), h = J(f, [f]);
|
|
75
75
|
}
|
|
76
76
|
break;
|
|
77
77
|
case "RELEASE":
|
|
78
|
-
|
|
78
|
+
h = void 0;
|
|
79
79
|
break;
|
|
80
80
|
default:
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
} catch (
|
|
84
|
-
|
|
83
|
+
} catch (u) {
|
|
84
|
+
h = { value: u, [E]: 0 };
|
|
85
85
|
}
|
|
86
|
-
Promise.resolve(
|
|
87
|
-
const [w,
|
|
88
|
-
|
|
89
|
-
}).catch((
|
|
90
|
-
const [w,
|
|
86
|
+
Promise.resolve(h).catch((u) => ({ value: u, [E]: 0 })).then((u) => {
|
|
87
|
+
const [w, f] = A(u);
|
|
88
|
+
t.postMessage(Object.assign(Object.assign({}, w), { id: a }), f), s === "RELEASE" && (t.removeEventListener("message", n), L(t), D in e && typeof e[D] == "function" && e[D]());
|
|
89
|
+
}).catch((u) => {
|
|
90
|
+
const [w, f] = A({
|
|
91
91
|
value: new TypeError("Unserializable return value"),
|
|
92
|
-
[
|
|
92
|
+
[E]: 0
|
|
93
93
|
});
|
|
94
|
-
|
|
94
|
+
t.postMessage(Object.assign(Object.assign({}, w), { id: a }), f);
|
|
95
95
|
});
|
|
96
|
-
}),
|
|
96
|
+
}), t.start && t.start();
|
|
97
97
|
}
|
|
98
|
-
function G(
|
|
99
|
-
return
|
|
98
|
+
function G(e) {
|
|
99
|
+
return e.constructor.name === "MessagePort";
|
|
100
100
|
}
|
|
101
|
-
function L(
|
|
102
|
-
G(
|
|
101
|
+
function L(e) {
|
|
102
|
+
G(e) && e.close();
|
|
103
103
|
}
|
|
104
|
-
function Y(
|
|
104
|
+
function Y(e, t) {
|
|
105
105
|
const r = /* @__PURE__ */ new Map();
|
|
106
|
-
return
|
|
107
|
-
const { data:
|
|
108
|
-
if (!
|
|
106
|
+
return e.addEventListener("message", function(i) {
|
|
107
|
+
const { data: a } = i;
|
|
108
|
+
if (!a || !a.id)
|
|
109
109
|
return;
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
110
|
+
const s = r.get(a.id);
|
|
111
|
+
if (s)
|
|
112
112
|
try {
|
|
113
|
-
|
|
113
|
+
s(a);
|
|
114
114
|
} finally {
|
|
115
|
-
r.delete(
|
|
115
|
+
r.delete(a.id);
|
|
116
116
|
}
|
|
117
|
-
}),
|
|
117
|
+
}), M(e, r, [], t);
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
if (
|
|
119
|
+
function p(e) {
|
|
120
|
+
if (e)
|
|
121
121
|
throw new Error("Proxy has been released and is not useable");
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
return d(
|
|
123
|
+
function U(e) {
|
|
124
|
+
return d(e, /* @__PURE__ */ new Map(), {
|
|
125
125
|
type: "RELEASE"
|
|
126
126
|
}).then(() => {
|
|
127
|
-
L(
|
|
127
|
+
L(e);
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
const F = /* @__PURE__ */ new WeakMap(), S = "FinalizationRegistry" in globalThis && new FinalizationRegistry((
|
|
131
|
-
const
|
|
132
|
-
F.set(
|
|
130
|
+
const F = /* @__PURE__ */ new WeakMap(), S = "FinalizationRegistry" in globalThis && new FinalizationRegistry((e) => {
|
|
131
|
+
const t = (F.get(e) || 0) - 1;
|
|
132
|
+
F.set(e, t), t === 0 && U(e);
|
|
133
133
|
});
|
|
134
|
-
function X(
|
|
135
|
-
const r = (F.get(
|
|
136
|
-
F.set(
|
|
134
|
+
function X(e, t) {
|
|
135
|
+
const r = (F.get(t) || 0) + 1;
|
|
136
|
+
F.set(t, r), S && S.register(e, t, e);
|
|
137
137
|
}
|
|
138
|
-
function q(
|
|
139
|
-
S && S.unregister(
|
|
138
|
+
function q(e) {
|
|
139
|
+
S && S.unregister(e);
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function M(e, t, r = [], n = function() {
|
|
142
142
|
}) {
|
|
143
|
-
let
|
|
144
|
-
const
|
|
145
|
-
get(
|
|
146
|
-
if (
|
|
143
|
+
let i = !1;
|
|
144
|
+
const a = new Proxy(n, {
|
|
145
|
+
get(s, o) {
|
|
146
|
+
if (p(i), o === B)
|
|
147
147
|
return () => {
|
|
148
|
-
q(
|
|
148
|
+
q(a), U(e), t.clear(), i = !0;
|
|
149
149
|
};
|
|
150
|
-
if (
|
|
150
|
+
if (o === "then") {
|
|
151
151
|
if (r.length === 0)
|
|
152
|
-
return { then: () =>
|
|
153
|
-
const l = d(
|
|
152
|
+
return { then: () => a };
|
|
153
|
+
const l = d(e, t, {
|
|
154
154
|
type: "GET",
|
|
155
|
-
path: r.map((
|
|
155
|
+
path: r.map((h) => h.toString())
|
|
156
156
|
}).then(y);
|
|
157
157
|
return l.then.bind(l);
|
|
158
158
|
}
|
|
159
|
-
return
|
|
159
|
+
return M(e, t, [...r, o]);
|
|
160
160
|
},
|
|
161
|
-
set(
|
|
162
|
-
|
|
163
|
-
const [
|
|
164
|
-
return d(
|
|
161
|
+
set(s, o, l) {
|
|
162
|
+
p(i);
|
|
163
|
+
const [h, u] = A(l);
|
|
164
|
+
return d(e, t, {
|
|
165
165
|
type: "SET",
|
|
166
|
-
path: [...r,
|
|
167
|
-
value:
|
|
168
|
-
},
|
|
166
|
+
path: [...r, o].map((w) => w.toString()),
|
|
167
|
+
value: h
|
|
168
|
+
}, u).then(y);
|
|
169
169
|
},
|
|
170
|
-
apply(
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
if (
|
|
174
|
-
return d(
|
|
170
|
+
apply(s, o, l) {
|
|
171
|
+
p(i);
|
|
172
|
+
const h = r[r.length - 1];
|
|
173
|
+
if (h === R)
|
|
174
|
+
return d(e, t, {
|
|
175
175
|
type: "ENDPOINT"
|
|
176
176
|
}).then(y);
|
|
177
|
-
if (
|
|
178
|
-
return
|
|
179
|
-
const [
|
|
180
|
-
return d(
|
|
177
|
+
if (h === "bind")
|
|
178
|
+
return M(e, t, r.slice(0, -1));
|
|
179
|
+
const [u, w] = N(l);
|
|
180
|
+
return d(e, t, {
|
|
181
181
|
type: "APPLY",
|
|
182
|
-
path: r.map((
|
|
183
|
-
argumentList:
|
|
182
|
+
path: r.map((f) => f.toString()),
|
|
183
|
+
argumentList: u
|
|
184
184
|
}, w).then(y);
|
|
185
185
|
},
|
|
186
|
-
construct(
|
|
187
|
-
|
|
188
|
-
const [l,
|
|
189
|
-
return d(
|
|
186
|
+
construct(s, o) {
|
|
187
|
+
p(i);
|
|
188
|
+
const [l, h] = N(o);
|
|
189
|
+
return d(e, t, {
|
|
190
190
|
type: "CONSTRUCT",
|
|
191
|
-
path: r.map((
|
|
191
|
+
path: r.map((u) => u.toString()),
|
|
192
192
|
argumentList: l
|
|
193
|
-
},
|
|
193
|
+
}, h).then(y);
|
|
194
194
|
}
|
|
195
195
|
});
|
|
196
|
-
return X(
|
|
196
|
+
return X(a, e), a;
|
|
197
197
|
}
|
|
198
|
-
function K(
|
|
199
|
-
return Array.prototype.concat.apply([],
|
|
198
|
+
function K(e) {
|
|
199
|
+
return Array.prototype.concat.apply([], e);
|
|
200
200
|
}
|
|
201
|
-
function
|
|
202
|
-
const
|
|
203
|
-
return [
|
|
201
|
+
function N(e) {
|
|
202
|
+
const t = e.map(A);
|
|
203
|
+
return [t.map((r) => r[0]), K(t.map((r) => r[1]))];
|
|
204
204
|
}
|
|
205
205
|
const _ = /* @__PURE__ */ new WeakMap();
|
|
206
|
-
function J(
|
|
207
|
-
return _.set(
|
|
206
|
+
function J(e, t) {
|
|
207
|
+
return _.set(e, t), e;
|
|
208
208
|
}
|
|
209
|
-
function Q(
|
|
210
|
-
return Object.assign(
|
|
209
|
+
function Q(e) {
|
|
210
|
+
return Object.assign(e, { [H]: !0 });
|
|
211
211
|
}
|
|
212
|
-
function A(
|
|
213
|
-
for (const [
|
|
214
|
-
if (r.canHandle(
|
|
215
|
-
const [
|
|
212
|
+
function A(e) {
|
|
213
|
+
for (const [t, r] of z)
|
|
214
|
+
if (r.canHandle(e)) {
|
|
215
|
+
const [n, i] = r.serialize(e);
|
|
216
216
|
return [
|
|
217
217
|
{
|
|
218
218
|
type: "HANDLER",
|
|
219
|
-
name:
|
|
220
|
-
value:
|
|
219
|
+
name: t,
|
|
220
|
+
value: n
|
|
221
221
|
},
|
|
222
|
-
|
|
222
|
+
i
|
|
223
223
|
];
|
|
224
224
|
}
|
|
225
225
|
return [
|
|
226
226
|
{
|
|
227
227
|
type: "RAW",
|
|
228
|
-
value:
|
|
228
|
+
value: e
|
|
229
229
|
},
|
|
230
|
-
_.get(
|
|
230
|
+
_.get(e) || []
|
|
231
231
|
];
|
|
232
232
|
}
|
|
233
|
-
function y(
|
|
234
|
-
switch (
|
|
233
|
+
function y(e) {
|
|
234
|
+
switch (e.type) {
|
|
235
235
|
case "HANDLER":
|
|
236
|
-
return
|
|
236
|
+
return z.get(e.name).deserialize(e.value);
|
|
237
237
|
case "RAW":
|
|
238
|
-
return
|
|
238
|
+
return e.value;
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
function d(
|
|
242
|
-
return new Promise((
|
|
243
|
-
const
|
|
244
|
-
|
|
241
|
+
function d(e, t, r, n) {
|
|
242
|
+
return new Promise((i) => {
|
|
243
|
+
const a = Z();
|
|
244
|
+
t.set(a, i), e.start && e.start(), e.postMessage(Object.assign({ id: a }, r), n);
|
|
245
245
|
});
|
|
246
246
|
}
|
|
247
247
|
function Z() {
|
|
248
248
|
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
|
|
249
249
|
}
|
|
250
250
|
class c extends Error {
|
|
251
|
-
constructor(
|
|
252
|
-
super(
|
|
251
|
+
constructor(t, r, n) {
|
|
252
|
+
super(t), this.code = r, this.path = n, this.name = "OPFSError";
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
class
|
|
255
|
+
class tt extends c {
|
|
256
256
|
constructor() {
|
|
257
257
|
super("OPFS is not supported in this browser", "OPFS_NOT_SUPPORTED");
|
|
258
258
|
}
|
|
@@ -262,165 +262,163 @@ class T extends c {
|
|
|
262
262
|
super("OPFS is not mounted", "OPFS_NOT_MOUNTED");
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
-
class
|
|
266
|
-
constructor(
|
|
267
|
-
super(
|
|
265
|
+
class k extends c {
|
|
266
|
+
constructor(t, r) {
|
|
267
|
+
super(t, "INVALID_PATH", r);
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
|
-
class
|
|
271
|
-
constructor(
|
|
272
|
-
super(\`File not found: \${
|
|
270
|
+
class O extends c {
|
|
271
|
+
constructor(t) {
|
|
272
|
+
super(\`File not found: \${t}\`, "FILE_NOT_FOUND", t);
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
-
function
|
|
276
|
-
switch (
|
|
275
|
+
function et(e, t = "utf-8") {
|
|
276
|
+
switch (t) {
|
|
277
277
|
case "utf8":
|
|
278
278
|
case "utf-8":
|
|
279
|
-
return new TextEncoder().encode(
|
|
279
|
+
return new TextEncoder().encode(e);
|
|
280
280
|
case "utf16le":
|
|
281
281
|
case "ucs2":
|
|
282
282
|
case "ucs-2":
|
|
283
|
-
return
|
|
283
|
+
return nt(e);
|
|
284
284
|
case "ascii":
|
|
285
|
-
return
|
|
285
|
+
return st(e);
|
|
286
286
|
case "latin1":
|
|
287
|
-
return
|
|
287
|
+
return at(e);
|
|
288
288
|
case "binary":
|
|
289
|
-
return Uint8Array.from(
|
|
289
|
+
return Uint8Array.from(e, (r) => r.charCodeAt(0));
|
|
290
290
|
case "base64":
|
|
291
|
-
return Uint8Array.from(atob(
|
|
291
|
+
return Uint8Array.from(atob(e), (r) => r.charCodeAt(0));
|
|
292
292
|
case "hex":
|
|
293
|
-
if (!/^[\\da-f]+$/i.test(
|
|
293
|
+
if (!/^[\\da-f]+$/i.test(e) || e.length % 2 !== 0)
|
|
294
294
|
throw new c("Invalid hex string", "INVALID_HEX_FORMAT");
|
|
295
|
-
return Uint8Array.from(
|
|
295
|
+
return Uint8Array.from(e.match(/.{1,2}/g).map((r) => parseInt(r, 16)));
|
|
296
296
|
default:
|
|
297
|
-
return console.warn("Encoding not supported, falling back to UTF-8"), new TextEncoder().encode(
|
|
297
|
+
return console.warn("Encoding not supported, falling back to UTF-8"), new TextEncoder().encode(e);
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
-
function
|
|
301
|
-
switch (
|
|
300
|
+
function rt(e, t = "utf-8") {
|
|
301
|
+
switch (t) {
|
|
302
302
|
case "utf8":
|
|
303
303
|
case "utf-8":
|
|
304
|
-
return new TextDecoder().decode(
|
|
304
|
+
return new TextDecoder().decode(e);
|
|
305
305
|
case "utf16le":
|
|
306
306
|
case "ucs2":
|
|
307
307
|
case "ucs-2":
|
|
308
|
-
return
|
|
308
|
+
return it(e);
|
|
309
309
|
case "latin1":
|
|
310
|
-
return String.fromCharCode(...
|
|
310
|
+
return String.fromCharCode(...e);
|
|
311
311
|
case "binary":
|
|
312
|
-
return String.fromCharCode(...
|
|
312
|
+
return String.fromCharCode(...e);
|
|
313
313
|
case "ascii":
|
|
314
|
-
return String.fromCharCode(...
|
|
314
|
+
return String.fromCharCode(...e.map((r) => r & 127));
|
|
315
315
|
case "base64":
|
|
316
|
-
return btoa(String.fromCharCode(...
|
|
316
|
+
return btoa(String.fromCharCode(...e));
|
|
317
317
|
case "hex":
|
|
318
|
-
return Array.from(
|
|
318
|
+
return Array.from(e).map((r) => r.toString(16).padStart(2, "0")).join("");
|
|
319
319
|
default:
|
|
320
|
-
return console.warn("Unsupported encoding, falling back to UTF-8"), new TextDecoder().decode(
|
|
320
|
+
return console.warn("Unsupported encoding, falling back to UTF-8"), new TextDecoder().decode(e);
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
|
-
function
|
|
324
|
-
const
|
|
325
|
-
for (let r = 0; r <
|
|
326
|
-
const
|
|
327
|
-
|
|
323
|
+
function nt(e) {
|
|
324
|
+
const t = new Uint8Array(e.length * 2);
|
|
325
|
+
for (let r = 0; r < e.length; r++) {
|
|
326
|
+
const n = e.charCodeAt(r);
|
|
327
|
+
t[r * 2] = n & 255, t[r * 2 + 1] = n >> 8;
|
|
328
328
|
}
|
|
329
|
-
return
|
|
329
|
+
return t;
|
|
330
330
|
}
|
|
331
|
-
function
|
|
332
|
-
|
|
333
|
-
const
|
|
334
|
-
return String.fromCharCode(...
|
|
331
|
+
function it(e) {
|
|
332
|
+
e.length % 2 !== 0 && (console.warn("Invalid UTF-16LE buffer length, truncating last byte"), e = e.slice(0, e.length - 1));
|
|
333
|
+
const t = new Uint16Array(e.buffer, e.byteOffset, e.byteLength / 2);
|
|
334
|
+
return String.fromCharCode(...t);
|
|
335
335
|
}
|
|
336
|
-
function
|
|
337
|
-
const
|
|
338
|
-
for (let r = 0; r <
|
|
339
|
-
|
|
340
|
-
return
|
|
336
|
+
function at(e) {
|
|
337
|
+
const t = new Uint8Array(e.length);
|
|
338
|
+
for (let r = 0; r < e.length; r++)
|
|
339
|
+
t[r] = e.charCodeAt(r) & 255;
|
|
340
|
+
return t;
|
|
341
341
|
}
|
|
342
|
-
function
|
|
343
|
-
const
|
|
344
|
-
for (let r = 0; r <
|
|
345
|
-
|
|
346
|
-
return
|
|
342
|
+
function st(e) {
|
|
343
|
+
const t = new Uint8Array(e.length);
|
|
344
|
+
for (let r = 0; r < e.length; r++)
|
|
345
|
+
t[r] = e.charCodeAt(r) & 127;
|
|
346
|
+
return t;
|
|
347
347
|
}
|
|
348
|
-
function
|
|
348
|
+
function ot() {
|
|
349
349
|
if (!("storage" in navigator) || !("getDirectory" in navigator.storage))
|
|
350
|
-
throw new
|
|
350
|
+
throw new tt();
|
|
351
351
|
}
|
|
352
|
-
function m(
|
|
353
|
-
return Array.isArray(
|
|
352
|
+
function m(e) {
|
|
353
|
+
return Array.isArray(e) ? e : e.split("/").filter(Boolean);
|
|
354
354
|
}
|
|
355
|
-
function
|
|
356
|
-
return typeof
|
|
355
|
+
function P(e) {
|
|
356
|
+
return typeof e == "string" ? e ?? "/" : \`/\${e.join("/")}\`;
|
|
357
357
|
}
|
|
358
|
-
function b(
|
|
359
|
-
const
|
|
360
|
-
return
|
|
358
|
+
function b(e) {
|
|
359
|
+
const t = m(e);
|
|
360
|
+
return t[t.length - 1] || "";
|
|
361
361
|
}
|
|
362
|
-
function
|
|
363
|
-
const
|
|
364
|
-
return
|
|
362
|
+
function x(e) {
|
|
363
|
+
const t = m(e);
|
|
364
|
+
return t.pop(), P(t);
|
|
365
365
|
}
|
|
366
|
-
function C(
|
|
367
|
-
return !
|
|
366
|
+
function C(e) {
|
|
367
|
+
return !e || e === "/" ? "/" : e.startsWith("/") ? e : \`/\${e}\`;
|
|
368
368
|
}
|
|
369
|
-
function
|
|
370
|
-
const
|
|
371
|
-
for (const
|
|
372
|
-
if (!(
|
|
373
|
-
if (
|
|
369
|
+
function ct(e) {
|
|
370
|
+
const t = m(e), r = [];
|
|
371
|
+
for (const n of t)
|
|
372
|
+
if (!(n === "." || n === ""))
|
|
373
|
+
if (n === "..") {
|
|
374
374
|
if (r.length === 0)
|
|
375
375
|
continue;
|
|
376
376
|
r.pop();
|
|
377
377
|
} else
|
|
378
|
-
r.push(
|
|
379
|
-
return
|
|
378
|
+
r.push(n);
|
|
379
|
+
return P(r);
|
|
380
380
|
}
|
|
381
|
-
function
|
|
382
|
-
return typeof
|
|
381
|
+
function lt(e, t = "utf-8") {
|
|
382
|
+
return typeof e == "string" ? et(e, t) : e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
383
383
|
}
|
|
384
|
-
async function
|
|
385
|
-
const
|
|
384
|
+
async function ht(e) {
|
|
385
|
+
const t = await e.createSyncAccessHandle();
|
|
386
386
|
try {
|
|
387
|
-
const r =
|
|
388
|
-
return
|
|
387
|
+
const r = t.getSize(), n = new Uint8Array(r);
|
|
388
|
+
return t.read(n, { at: 0 }), n;
|
|
389
389
|
} finally {
|
|
390
|
-
|
|
390
|
+
t.close();
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
|
-
async function
|
|
394
|
-
let
|
|
393
|
+
async function v(e, t, r, n = {}) {
|
|
394
|
+
let i = null;
|
|
395
395
|
try {
|
|
396
|
-
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
} catch (
|
|
400
|
-
console.error(
|
|
401
|
-
const
|
|
402
|
-
throw new c(\`Failed to \${
|
|
396
|
+
i = await e.createSyncAccessHandle();
|
|
397
|
+
const a = lt(t, r), s = n.append ? i.getSize() : 0;
|
|
398
|
+
i.write(a, { at: s }), n.truncate && !n.append && i.truncate(a.byteLength), i.flush();
|
|
399
|
+
} catch (a) {
|
|
400
|
+
console.error(a);
|
|
401
|
+
const s = n.append ? "append" : "write";
|
|
402
|
+
throw new c(\`Failed to \${s} file\`, \`\${s.toUpperCase()}_FAILED\`);
|
|
403
403
|
} finally {
|
|
404
|
-
if (
|
|
404
|
+
if (i)
|
|
405
405
|
try {
|
|
406
|
-
|
|
406
|
+
i.close();
|
|
407
407
|
} catch {
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
|
-
async function
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
throw console.warn(\`Failed to calculate \${e} hash:\`, r), r;
|
|
417
|
-
}
|
|
411
|
+
async function ut(e, t = "SHA-1", r = 50 * 1024 * 1024) {
|
|
412
|
+
if (e instanceof File && (e = await e.arrayBuffer()), e.byteLength > r)
|
|
413
|
+
throw new Error(\`File size \${e.byteLength} bytes exceeds maximum allowed size \${r} bytes\`);
|
|
414
|
+
const n = new Uint8Array(e), i = await crypto.subtle.digest(t, n);
|
|
415
|
+
return Array.from(new Uint8Array(i)).map((s) => s.toString(16).padStart(2, "0")).join("");
|
|
418
416
|
}
|
|
419
|
-
async function
|
|
420
|
-
const
|
|
421
|
-
return new Uint8Array(
|
|
417
|
+
async function ft(e) {
|
|
418
|
+
const t = await e.arrayBuffer();
|
|
419
|
+
return new Uint8Array(t);
|
|
422
420
|
}
|
|
423
|
-
class
|
|
421
|
+
class wt {
|
|
424
422
|
/** Root directory handle for the file system */
|
|
425
423
|
root = null;
|
|
426
424
|
/** Watch event callback */
|
|
@@ -429,12 +427,16 @@ class we {
|
|
|
429
427
|
watchers = /* @__PURE__ */ new Map();
|
|
430
428
|
/** Interval handle for polling watched paths */
|
|
431
429
|
watchTimer = null;
|
|
432
|
-
/** Polling interval in milliseconds */
|
|
433
|
-
watchInterval = 1e3;
|
|
434
430
|
/** Flag to avoid concurrent scans */
|
|
435
431
|
scanning = !1;
|
|
436
432
|
/** Promise to prevent concurrent mount operations */
|
|
437
433
|
mountingPromise = null;
|
|
434
|
+
/** Configuration options */
|
|
435
|
+
options = {
|
|
436
|
+
watchInterval: 1e3,
|
|
437
|
+
maxFileSize: 50 * 1024 * 1024,
|
|
438
|
+
hashAlgorithm: null
|
|
439
|
+
};
|
|
438
440
|
/**
|
|
439
441
|
* Notify about internal changes to the file system
|
|
440
442
|
*
|
|
@@ -444,21 +446,35 @@ class we {
|
|
|
444
446
|
* @param path - The path that was changed
|
|
445
447
|
* @param type - The type of change (create, change, delete)
|
|
446
448
|
*/
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
449
|
+
async notifyChange(t) {
|
|
450
|
+
if (!this.watchCallback)
|
|
451
|
+
return;
|
|
452
|
+
let r;
|
|
453
|
+
if (this.options.hashAlgorithm && !t.isDirectory && t.type !== "removed")
|
|
454
|
+
try {
|
|
455
|
+
const n = await this.stat(t.path);
|
|
456
|
+
n.isFile && n.hash && (r = n.hash);
|
|
457
|
+
} catch (n) {
|
|
458
|
+
console.warn(\`Failed to calculate hash for \${t.path}:\`, n);
|
|
459
|
+
}
|
|
460
|
+
this.watchCallback({
|
|
461
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
462
|
+
...t,
|
|
463
|
+
...r && { hash: r }
|
|
451
464
|
});
|
|
452
465
|
}
|
|
453
466
|
/**
|
|
454
467
|
* Creates a new OPFSFileSystem instance
|
|
455
468
|
*
|
|
456
469
|
* @param watchCallback - Optional callback for file change events
|
|
457
|
-
* @param
|
|
470
|
+
* @param options - Optional configuration options
|
|
471
|
+
* @param options.watchInterval - Polling interval in milliseconds for file watching
|
|
472
|
+
* @param options.hashAlgorithm - Hash algorithm for file hashing
|
|
473
|
+
* @param options.maxFileSize - Maximum file size for hashing in bytes (default: 50MB)
|
|
458
474
|
* @throws {OPFSError} If OPFS is not supported in the current browser
|
|
459
475
|
*/
|
|
460
|
-
constructor(
|
|
461
|
-
|
|
476
|
+
constructor(t, r) {
|
|
477
|
+
ot(), t && (this.watchCallback = t), r && this.setOptions(r), this.mount("/");
|
|
462
478
|
}
|
|
463
479
|
/**
|
|
464
480
|
* Initialize the file system within a given directory
|
|
@@ -481,14 +497,14 @@ class we {
|
|
|
481
497
|
* await fs.mount('/my-app');
|
|
482
498
|
* \`\`\`
|
|
483
499
|
*/
|
|
484
|
-
async mount(
|
|
485
|
-
return this.mountingPromise && await this.mountingPromise, this.mountingPromise = new Promise(async (r,
|
|
500
|
+
async mount(t = "/") {
|
|
501
|
+
return this.mountingPromise && await this.mountingPromise, this.mountingPromise = new Promise(async (r, n) => {
|
|
486
502
|
this.root = null;
|
|
487
503
|
try {
|
|
488
|
-
const
|
|
489
|
-
|
|
490
|
-
} catch (
|
|
491
|
-
console.error(
|
|
504
|
+
const i = await navigator.storage.getDirectory();
|
|
505
|
+
t === "/" ? this.root = i : this.root = await this.getDirectoryHandle(t, !0, i), r(!0);
|
|
506
|
+
} catch (i) {
|
|
507
|
+
console.error(i), n(new c("Failed to initialize OPFS", "INIT_FAILED"));
|
|
492
508
|
} finally {
|
|
493
509
|
this.mountingPromise = null;
|
|
494
510
|
}
|
|
@@ -498,10 +514,20 @@ class we {
|
|
|
498
514
|
* Set the watch callback for file change events
|
|
499
515
|
*
|
|
500
516
|
* @param callback - The callback function to invoke when files change
|
|
501
|
-
* @param options - Optional configuration for watching
|
|
502
517
|
*/
|
|
503
|
-
setWatchCallback(
|
|
504
|
-
this.watchCallback =
|
|
518
|
+
setWatchCallback(t) {
|
|
519
|
+
this.watchCallback = t;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Update configuration options
|
|
523
|
+
*
|
|
524
|
+
* @param options - Configuration options to update
|
|
525
|
+
* @param options.watchInterval - Polling interval in milliseconds for file watching
|
|
526
|
+
* @param options.hashAlgorithm - Hash algorithm for file hashing
|
|
527
|
+
* @param options.maxFileSize - Maximum file size for hashing in bytes
|
|
528
|
+
*/
|
|
529
|
+
setOptions(t) {
|
|
530
|
+
t.watchInterval !== void 0 && (this.options.watchInterval = t.watchInterval), t.hashAlgorithm !== void 0 && (this.options.hashAlgorithm = t.hashAlgorithm), t.maxFileSize !== void 0 && (this.options.maxFileSize = t.maxFileSize);
|
|
505
531
|
}
|
|
506
532
|
/**
|
|
507
533
|
* Automatically mount the OPFS root if not already mounted
|
|
@@ -539,14 +565,14 @@ class we {
|
|
|
539
565
|
* const docsDir2 = await fs.getDirectoryHandle(['users', 'john', 'documents'], true);
|
|
540
566
|
* \`\`\`
|
|
541
567
|
*/
|
|
542
|
-
async getDirectoryHandle(
|
|
543
|
-
if (!
|
|
568
|
+
async getDirectoryHandle(t, r = !1, n = this.root) {
|
|
569
|
+
if (!n)
|
|
544
570
|
throw new T();
|
|
545
|
-
const
|
|
546
|
-
let
|
|
547
|
-
for (const
|
|
548
|
-
|
|
549
|
-
return
|
|
571
|
+
const i = Array.isArray(t) ? t : m(t);
|
|
572
|
+
let a = n;
|
|
573
|
+
for (const s of i)
|
|
574
|
+
a = await a.getDirectoryHandle(s, { create: r });
|
|
575
|
+
return a;
|
|
550
576
|
}
|
|
551
577
|
/**
|
|
552
578
|
* Get a file handle from a path
|
|
@@ -567,45 +593,27 @@ class we {
|
|
|
567
593
|
* const fileHandle2 = await fs.getFileHandle(['config', 'settings.json'], true);
|
|
568
594
|
* \`\`\`
|
|
569
595
|
*/
|
|
570
|
-
async getFileHandle(
|
|
571
|
-
if (!
|
|
596
|
+
async getFileHandle(t, r = !1, n = this.root) {
|
|
597
|
+
if (!n)
|
|
572
598
|
throw new T();
|
|
573
|
-
const
|
|
574
|
-
if (
|
|
575
|
-
throw new
|
|
576
|
-
const
|
|
577
|
-
return (await this.getDirectoryHandle(
|
|
599
|
+
const i = m(t);
|
|
600
|
+
if (i.length === 0)
|
|
601
|
+
throw new k("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
|
|
602
|
+
const a = i.pop();
|
|
603
|
+
return (await this.getDirectoryHandle(i, r, n)).getFileHandle(a, { create: r });
|
|
578
604
|
}
|
|
579
605
|
/**
|
|
580
|
-
*
|
|
606
|
+
* Get a complete index of all files and directories in the file system
|
|
581
607
|
*
|
|
582
|
-
*
|
|
583
|
-
* a Map containing
|
|
608
|
+
* This method recursively traverses the entire file system and returns
|
|
609
|
+
* a Map containing FileStat objects for every file and directory.
|
|
584
610
|
*
|
|
585
|
-
* @
|
|
586
|
-
* @
|
|
587
|
-
* @param options.hashAlgorithm - Hash algorithm to use (default: 'SHA-1', fastest)
|
|
588
|
-
* @returns Promise that resolves to a Map of path => FileStat
|
|
589
|
-
* @throws {OPFSError} If the indexing operation fails
|
|
611
|
+
* @returns Promise that resolves to a Map of paths to FileStat objects
|
|
612
|
+
* @throws {OPFSError} If the file system is not mounted
|
|
590
613
|
*
|
|
591
614
|
* @example
|
|
592
615
|
* \`\`\`typescript
|
|
593
|
-
* // Basic index without hash
|
|
594
616
|
* const index = await fs.index();
|
|
595
|
-
*
|
|
596
|
-
* // Index with file hash
|
|
597
|
-
* const indexWithHash = await fs.index({
|
|
598
|
-
* includeHash: true,
|
|
599
|
-
* hashAlgorithm: 'SHA-1'
|
|
600
|
-
* });
|
|
601
|
-
*
|
|
602
|
-
* // Iterate through all files and directories
|
|
603
|
-
* for (const [path, stat] of index) {
|
|
604
|
-
* console.log(\`\${path}: \${stat.isFile ? 'file' : 'directory'} (\${stat.size} bytes)\`);
|
|
605
|
-
* if (stat.hash) console.log(\` Hash: \${stat.hash}\`);
|
|
606
|
-
* }
|
|
607
|
-
*
|
|
608
|
-
* // Get specific file stats
|
|
609
617
|
* const fileStats = index.get('/data/config.json');
|
|
610
618
|
* if (fileStats) {
|
|
611
619
|
* console.log(\`File size: \${fileStats.size} bytes\`);
|
|
@@ -613,35 +621,35 @@ class we {
|
|
|
613
621
|
* }
|
|
614
622
|
* \`\`\`
|
|
615
623
|
*/
|
|
616
|
-
async index(
|
|
617
|
-
const
|
|
624
|
+
async index() {
|
|
625
|
+
const t = /* @__PURE__ */ new Map(), r = async (n) => {
|
|
618
626
|
const i = await this.readdir(n, { withFileTypes: !0 });
|
|
619
|
-
for (const
|
|
620
|
-
const s = \`\${n === "/" ? "" : n}/\${
|
|
627
|
+
for (const a of i) {
|
|
628
|
+
const s = \`\${n === "/" ? "" : n}/\${a.name}\`;
|
|
621
629
|
try {
|
|
622
|
-
const
|
|
623
|
-
|
|
624
|
-
} catch (
|
|
625
|
-
console.warn(\`Skipping broken entry: \${s}\`,
|
|
630
|
+
const o = await this.stat(s);
|
|
631
|
+
t.set(s, o), o.isDirectory && await r(s);
|
|
632
|
+
} catch (o) {
|
|
633
|
+
console.warn(\`Skipping broken entry: \${s}\`, o);
|
|
626
634
|
}
|
|
627
635
|
}
|
|
628
636
|
};
|
|
629
|
-
return
|
|
637
|
+
return t.set("/", {
|
|
630
638
|
kind: "directory",
|
|
631
639
|
size: 0,
|
|
632
640
|
mtime: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
633
641
|
ctime: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
634
642
|
isFile: !1,
|
|
635
643
|
isDirectory: !0
|
|
636
|
-
}), await
|
|
644
|
+
}), await r("/"), t;
|
|
637
645
|
}
|
|
638
|
-
async readFile(
|
|
646
|
+
async readFile(t, r = "utf-8") {
|
|
639
647
|
await this.ensureMounted();
|
|
640
648
|
try {
|
|
641
|
-
const
|
|
642
|
-
return r === "binary" ?
|
|
643
|
-
} catch (
|
|
644
|
-
throw console.error(
|
|
649
|
+
const n = await this.getFileHandle(t, !1), i = await ht(n);
|
|
650
|
+
return r === "binary" ? i : rt(i, r);
|
|
651
|
+
} catch (n) {
|
|
652
|
+
throw console.error(n), new O(t);
|
|
645
653
|
}
|
|
646
654
|
}
|
|
647
655
|
/**
|
|
@@ -669,10 +677,10 @@ class we {
|
|
|
669
677
|
* await fs.writeFile('/data/utf16.txt', 'Hello World', 'utf-16le');
|
|
670
678
|
* \`\`\`
|
|
671
679
|
*/
|
|
672
|
-
async writeFile(
|
|
680
|
+
async writeFile(t, r, n) {
|
|
673
681
|
await this.ensureMounted();
|
|
674
|
-
const
|
|
675
|
-
await
|
|
682
|
+
const i = await this.getFileHandle(t, !0);
|
|
683
|
+
await v(i, r, n, { truncate: !0 }), await this.notifyChange({ path: t, type: "changed", isDirectory: !1 });
|
|
676
684
|
}
|
|
677
685
|
/**
|
|
678
686
|
* Append data to a file
|
|
@@ -696,10 +704,10 @@ class we {
|
|
|
696
704
|
* await fs.appendFile('/data/binary.dat', additionalData);
|
|
697
705
|
* \`\`\`
|
|
698
706
|
*/
|
|
699
|
-
async appendFile(
|
|
707
|
+
async appendFile(t, r, n) {
|
|
700
708
|
await this.ensureMounted();
|
|
701
|
-
const
|
|
702
|
-
await
|
|
709
|
+
const i = await this.getFileHandle(t, !0);
|
|
710
|
+
await v(i, r, n, { append: !0 }), await this.notifyChange({ path: t, type: "changed", isDirectory: !1 });
|
|
703
711
|
}
|
|
704
712
|
/**
|
|
705
713
|
* Create a directory
|
|
@@ -722,55 +730,48 @@ class we {
|
|
|
722
730
|
* await fs.mkdir('/users/john/documents/projects', { recursive: true });
|
|
723
731
|
* \`\`\`
|
|
724
732
|
*/
|
|
725
|
-
async mkdir(
|
|
733
|
+
async mkdir(t, r) {
|
|
726
734
|
if (await this.ensureMounted(), !this.root)
|
|
727
735
|
throw new T();
|
|
728
|
-
const
|
|
729
|
-
let
|
|
730
|
-
for (let
|
|
731
|
-
const
|
|
736
|
+
const n = r?.recursive ?? !1, i = m(t);
|
|
737
|
+
let a = this.root;
|
|
738
|
+
for (let s = 0; s < i.length; s++) {
|
|
739
|
+
const o = i[s];
|
|
732
740
|
try {
|
|
733
|
-
|
|
741
|
+
a = await a.getDirectoryHandle(o, { create: n || s === i.length - 1 });
|
|
734
742
|
} catch (l) {
|
|
735
743
|
throw l.name === "NotFoundError" ? new c(
|
|
736
|
-
\`Parent directory does not exist: \${
|
|
744
|
+
\`Parent directory does not exist: \${P(i.slice(0, s + 1))}\`,
|
|
737
745
|
"ENOENT"
|
|
738
|
-
) : l.name === "TypeMismatchError" ? new c(\`Path segment is not a directory: \${
|
|
746
|
+
) : l.name === "TypeMismatchError" ? new c(\`Path segment is not a directory: \${o}\`, "ENOTDIR") : new c("Failed to create directory", "MKDIR_FAILED");
|
|
739
747
|
}
|
|
740
748
|
}
|
|
741
|
-
this.
|
|
749
|
+
await this.notifyChange({ path: t, type: "added", isDirectory: !0 });
|
|
742
750
|
}
|
|
743
751
|
/**
|
|
744
|
-
* Get file or directory
|
|
752
|
+
* Get file or directory statistics
|
|
745
753
|
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
754
|
+
* Returns detailed information about a file or directory, including
|
|
755
|
+
* size, modification time, and optionally a hash of the file content.
|
|
748
756
|
*
|
|
749
757
|
* @param path - The path to the file or directory
|
|
750
|
-
* @
|
|
751
|
-
* @
|
|
752
|
-
* @param options.hashAlgorithm - Hash algorithm to use (default: 'SHA-1', fastest)
|
|
753
|
-
* @returns Promise that resolves to file/directory statistics
|
|
754
|
-
* @throws {OPFSError} If the file or directory does not exist or cannot be accessed
|
|
758
|
+
* @returns Promise that resolves to FileStat object
|
|
759
|
+
* @throws {OPFSError} If the path does not exist or cannot be accessed
|
|
755
760
|
*
|
|
756
761
|
* @example
|
|
757
762
|
* \`\`\`typescript
|
|
758
|
-
*
|
|
759
|
-
* const stats = await fs.stat('/config/settings.json');
|
|
763
|
+
* const stats = await fs.stat('/data/config.json');
|
|
760
764
|
* console.log(\`File size: \${stats.size} bytes\`);
|
|
761
|
-
* console.log(\`
|
|
762
|
-
*
|
|
763
|
-
*
|
|
764
|
-
*
|
|
765
|
-
*
|
|
766
|
-
*
|
|
767
|
-
* hashAlgorithm: 'SHA-1'
|
|
768
|
-
* });
|
|
769
|
-
* console.log(\`Hash: \${statsWithHash.hash}\`);
|
|
765
|
+
* console.log(\`Last modified: \${stats.mtime}\`);
|
|
766
|
+
*
|
|
767
|
+
* // If hashing is enabled, hash will be included
|
|
768
|
+
* if (stats.hash) {
|
|
769
|
+
* console.log(\`Hash: \${stats.hash}\`);
|
|
770
|
+
* }
|
|
770
771
|
* \`\`\`
|
|
771
772
|
*/
|
|
772
|
-
async stat(
|
|
773
|
-
if (await this.ensureMounted(),
|
|
773
|
+
async stat(t) {
|
|
774
|
+
if (await this.ensureMounted(), t === "/")
|
|
774
775
|
return {
|
|
775
776
|
kind: "directory",
|
|
776
777
|
size: 0,
|
|
@@ -779,30 +780,30 @@ class we {
|
|
|
779
780
|
isFile: !1,
|
|
780
781
|
isDirectory: !0
|
|
781
782
|
};
|
|
782
|
-
const
|
|
783
|
+
const r = b(t), n = await this.getDirectoryHandle(x(t), !1), i = this.options.hashAlgorithm !== null;
|
|
783
784
|
try {
|
|
784
|
-
const
|
|
785
|
+
const s = await (await n.getFileHandle(r, { create: !1 })).getFile(), o = {
|
|
785
786
|
kind: "file",
|
|
786
|
-
size:
|
|
787
|
-
mtime: new Date(
|
|
788
|
-
ctime: new Date(
|
|
787
|
+
size: s.size,
|
|
788
|
+
mtime: new Date(s.lastModified).toISOString(),
|
|
789
|
+
ctime: new Date(s.lastModified).toISOString(),
|
|
789
790
|
isFile: !0,
|
|
790
791
|
isDirectory: !1
|
|
791
792
|
};
|
|
792
|
-
if (i)
|
|
793
|
+
if (i && this.options.hashAlgorithm)
|
|
793
794
|
try {
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
} catch (
|
|
797
|
-
console.warn(\`Failed to calculate hash for \${
|
|
795
|
+
const l = await ut(s, this.options.hashAlgorithm, this.options.maxFileSize);
|
|
796
|
+
o.hash = l;
|
|
797
|
+
} catch (l) {
|
|
798
|
+
console.warn(\`Failed to calculate hash for \${t}:\`, l);
|
|
798
799
|
}
|
|
799
|
-
return
|
|
800
|
-
} catch (
|
|
801
|
-
if (
|
|
800
|
+
return o;
|
|
801
|
+
} catch (a) {
|
|
802
|
+
if (a.name !== "TypeMismatchError" && a.name !== "NotFoundError")
|
|
802
803
|
throw new c("Failed to stat (file)", "STAT_FAILED");
|
|
803
804
|
}
|
|
804
805
|
try {
|
|
805
|
-
return await n.getDirectoryHandle(
|
|
806
|
+
return await n.getDirectoryHandle(r, { create: !1 }), {
|
|
806
807
|
kind: "directory",
|
|
807
808
|
size: 0,
|
|
808
809
|
mtime: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
@@ -810,30 +811,30 @@ class we {
|
|
|
810
811
|
isFile: !1,
|
|
811
812
|
isDirectory: !0
|
|
812
813
|
};
|
|
813
|
-
} catch (
|
|
814
|
-
throw
|
|
814
|
+
} catch (a) {
|
|
815
|
+
throw a.name === "NotFoundError" ? new c(\`No such file or directory: \${t}\`, "ENOENT") : new c("Failed to stat (directory)", "STAT_FAILED");
|
|
815
816
|
}
|
|
816
817
|
}
|
|
817
|
-
async readdir(
|
|
818
|
+
async readdir(t, r) {
|
|
818
819
|
await this.ensureMounted();
|
|
819
|
-
const
|
|
820
|
-
if (
|
|
821
|
-
const
|
|
822
|
-
for await (const [
|
|
823
|
-
const l =
|
|
824
|
-
|
|
825
|
-
name:
|
|
826
|
-
kind:
|
|
820
|
+
const n = r?.withFileTypes ?? !1, i = await this.getDirectoryHandle(t, !1);
|
|
821
|
+
if (n) {
|
|
822
|
+
const a = [];
|
|
823
|
+
for await (const [s, o] of i.entries()) {
|
|
824
|
+
const l = o.kind === "file";
|
|
825
|
+
a.push({
|
|
826
|
+
name: s,
|
|
827
|
+
kind: o.kind,
|
|
827
828
|
isFile: l,
|
|
828
829
|
isDirectory: !l
|
|
829
830
|
});
|
|
830
831
|
}
|
|
831
|
-
return
|
|
832
|
+
return a;
|
|
832
833
|
} else {
|
|
833
|
-
const
|
|
834
|
-
for await (const [
|
|
835
|
-
|
|
836
|
-
return
|
|
834
|
+
const a = [];
|
|
835
|
+
for await (const [s] of i.entries())
|
|
836
|
+
a.push(s);
|
|
837
|
+
return a;
|
|
837
838
|
}
|
|
838
839
|
}
|
|
839
840
|
/**
|
|
@@ -850,29 +851,29 @@ class we {
|
|
|
850
851
|
* console.log(\`File exists: \${exists}\`);
|
|
851
852
|
* \`\`\`
|
|
852
853
|
*/
|
|
853
|
-
async exists(
|
|
854
|
-
if (await this.ensureMounted(),
|
|
854
|
+
async exists(t) {
|
|
855
|
+
if (await this.ensureMounted(), t === "/")
|
|
855
856
|
return !0;
|
|
856
|
-
const r = b(
|
|
857
|
-
let
|
|
857
|
+
const r = b(t);
|
|
858
|
+
let n = null;
|
|
858
859
|
try {
|
|
859
|
-
|
|
860
|
-
} catch (
|
|
861
|
-
throw (
|
|
860
|
+
n = await this.getDirectoryHandle(x(t), !1);
|
|
861
|
+
} catch (i) {
|
|
862
|
+
throw (i.name === "NotFoundError" || i.name === "TypeMismatchError") && (n = null), i;
|
|
862
863
|
}
|
|
863
|
-
if (!
|
|
864
|
+
if (!n || !r)
|
|
864
865
|
return !1;
|
|
865
866
|
try {
|
|
866
|
-
return await
|
|
867
|
-
} catch (
|
|
868
|
-
if (
|
|
869
|
-
throw
|
|
867
|
+
return await n.getFileHandle(r, { create: !1 }), !0;
|
|
868
|
+
} catch (i) {
|
|
869
|
+
if (i.name !== "NotFoundError" && i.name !== "TypeMismatchError")
|
|
870
|
+
throw i;
|
|
870
871
|
}
|
|
871
872
|
try {
|
|
872
|
-
return await
|
|
873
|
-
} catch (
|
|
874
|
-
if (
|
|
875
|
-
throw
|
|
873
|
+
return await n.getDirectoryHandle(r, { create: !1 }), !0;
|
|
874
|
+
} catch (i) {
|
|
875
|
+
if (i.name !== "NotFoundError" && i.name !== "TypeMismatchError")
|
|
876
|
+
throw i;
|
|
876
877
|
}
|
|
877
878
|
return !1;
|
|
878
879
|
}
|
|
@@ -895,17 +896,17 @@ class we {
|
|
|
895
896
|
* await fs.clear('/data');
|
|
896
897
|
* \`\`\`
|
|
897
898
|
*/
|
|
898
|
-
async clear(
|
|
899
|
+
async clear(t = "/") {
|
|
899
900
|
await this.ensureMounted();
|
|
900
901
|
try {
|
|
901
|
-
const r = await this.readdir(
|
|
902
|
-
for (const
|
|
903
|
-
const
|
|
904
|
-
await this.remove(
|
|
902
|
+
const r = await this.readdir(t, { withFileTypes: !0 });
|
|
903
|
+
for (const n of r) {
|
|
904
|
+
const i = \`\${t === "/" ? "" : t}/\${n.name}\`;
|
|
905
|
+
await this.remove(i, { recursive: !0 });
|
|
905
906
|
}
|
|
906
|
-
this.
|
|
907
|
+
await this.notifyChange({ path: t, type: "changed", isDirectory: !0 });
|
|
907
908
|
} catch (r) {
|
|
908
|
-
throw r instanceof c ? r : new c(\`Failed to clear directory: \${
|
|
909
|
+
throw r instanceof c ? r : new c(\`Failed to clear directory: \${t}\`, "CLEAR_FAILED");
|
|
909
910
|
}
|
|
910
911
|
}
|
|
911
912
|
/**
|
|
@@ -932,24 +933,24 @@ class we {
|
|
|
932
933
|
* await fs.rm('/maybe/exists', { force: true });
|
|
933
934
|
* \`\`\`
|
|
934
935
|
*/
|
|
935
|
-
async remove(
|
|
936
|
+
async remove(t, r) {
|
|
936
937
|
await this.ensureMounted();
|
|
937
|
-
const
|
|
938
|
-
if (
|
|
938
|
+
const n = r?.recursive ?? !1, i = r?.force ?? !1;
|
|
939
|
+
if (t === "/")
|
|
939
940
|
throw new c("Cannot remove root directory", "EROOT");
|
|
940
|
-
const
|
|
941
|
-
if (!
|
|
942
|
-
throw new
|
|
943
|
-
const
|
|
941
|
+
const a = b(t);
|
|
942
|
+
if (!a)
|
|
943
|
+
throw new k("Invalid path", t);
|
|
944
|
+
const s = await this.getDirectoryHandle(x(t), !1);
|
|
944
945
|
try {
|
|
945
|
-
await
|
|
946
|
-
} catch (
|
|
947
|
-
if (
|
|
948
|
-
if (!
|
|
949
|
-
throw new c(\`No such file or directory: \${
|
|
950
|
-
} else throw
|
|
946
|
+
await s.removeEntry(a, { recursive: n });
|
|
947
|
+
} catch (o) {
|
|
948
|
+
if (o.name === "NotFoundError") {
|
|
949
|
+
if (!i)
|
|
950
|
+
throw new c(\`No such file or directory: \${t}\`, "ENOENT");
|
|
951
|
+
} else throw o.name === "InvalidModificationError" ? new c(\`Directory not empty: \${t}. Use recursive option to force removal.\`, "ENOTEMPTY") : o.name === "TypeMismatchError" && !n ? new c(\`Cannot remove directory without recursive option: \${t}\`, "EISDIR") : new c(\`Failed to remove path: \${t}\`, "RM_FAILED");
|
|
951
952
|
}
|
|
952
|
-
this.
|
|
953
|
+
await this.notifyChange({ path: t, type: "removed", isDirectory: !1 });
|
|
953
954
|
}
|
|
954
955
|
/**
|
|
955
956
|
* Resolve a path to an absolute path
|
|
@@ -969,15 +970,15 @@ class we {
|
|
|
969
970
|
* console.log(absolute); // '/data/file.txt'
|
|
970
971
|
* \`\`\`
|
|
971
972
|
*/
|
|
972
|
-
async realpath(
|
|
973
|
+
async realpath(t) {
|
|
973
974
|
await this.ensureMounted();
|
|
974
975
|
try {
|
|
975
|
-
const r =
|
|
976
|
+
const r = ct(t);
|
|
976
977
|
if (!await this.exists(r))
|
|
977
|
-
throw new
|
|
978
|
+
throw new O(r);
|
|
978
979
|
return r;
|
|
979
980
|
} catch (r) {
|
|
980
|
-
throw r instanceof c ? r : new c(\`Failed to resolve path: \${
|
|
981
|
+
throw r instanceof c ? r : new c(\`Failed to resolve path: \${t}\`, "REALPATH_FAILED");
|
|
981
982
|
}
|
|
982
983
|
}
|
|
983
984
|
/**
|
|
@@ -996,14 +997,14 @@ class we {
|
|
|
996
997
|
* await fs.rename('/old/path/file.txt', '/new/path/renamed.txt');
|
|
997
998
|
* \`\`\`
|
|
998
999
|
*/
|
|
999
|
-
async rename(
|
|
1000
|
+
async rename(t, r) {
|
|
1000
1001
|
await this.ensureMounted();
|
|
1001
1002
|
try {
|
|
1002
|
-
if (!await this.exists(
|
|
1003
|
-
throw new
|
|
1004
|
-
await this.copy(
|
|
1005
|
-
} catch (
|
|
1006
|
-
throw
|
|
1003
|
+
if (!await this.exists(t))
|
|
1004
|
+
throw new O(t);
|
|
1005
|
+
await this.copy(t, r, { recursive: !0 }), await this.remove(t, { recursive: !0 }), await this.notifyChange({ path: t, type: "removed", isDirectory: !1 }), await this.notifyChange({ path: r, type: "added", isDirectory: !1 });
|
|
1006
|
+
} catch (n) {
|
|
1007
|
+
throw n instanceof c ? n : new c(\`Failed to rename from \${t} to \${r}\`, "RENAME_FAILED");
|
|
1007
1008
|
}
|
|
1008
1009
|
}
|
|
1009
1010
|
/**
|
|
@@ -1031,85 +1032,81 @@ class we {
|
|
|
1031
1032
|
* await fs.copy('/source', '/dest', { recursive: true, force: false });
|
|
1032
1033
|
* \`\`\`
|
|
1033
1034
|
*/
|
|
1034
|
-
async copy(
|
|
1035
|
+
async copy(t, r, n) {
|
|
1035
1036
|
await this.ensureMounted();
|
|
1036
1037
|
try {
|
|
1037
|
-
const
|
|
1038
|
-
if (!await this.exists(
|
|
1039
|
-
throw new c(\`Source does not exist: \${
|
|
1040
|
-
if (await this.exists(r) && !
|
|
1038
|
+
const i = n?.recursive ?? !1, a = n?.force ?? !0;
|
|
1039
|
+
if (!await this.exists(t))
|
|
1040
|
+
throw new c(\`Source does not exist: \${t}\`, "ENOENT");
|
|
1041
|
+
if (await this.exists(r) && !a)
|
|
1041
1042
|
throw new c(\`Destination already exists: \${r}\`, "EEXIST");
|
|
1042
|
-
if ((await this.stat(
|
|
1043
|
-
const
|
|
1044
|
-
await this.writeFile(r,
|
|
1043
|
+
if ((await this.stat(t)).isFile) {
|
|
1044
|
+
const h = await this.readFile(t, "binary");
|
|
1045
|
+
await this.writeFile(r, h);
|
|
1045
1046
|
} else {
|
|
1046
|
-
if (!
|
|
1047
|
-
throw new c(\`Cannot copy directory without recursive option: \${
|
|
1047
|
+
if (!i)
|
|
1048
|
+
throw new c(\`Cannot copy directory without recursive option: \${t}\`, "EISDIR");
|
|
1048
1049
|
await this.mkdir(r, { recursive: !0 });
|
|
1049
|
-
const
|
|
1050
|
-
for (const
|
|
1051
|
-
const w = \`\${
|
|
1052
|
-
await this.copy(w,
|
|
1050
|
+
const h = await this.readdir(t, { withFileTypes: !0 });
|
|
1051
|
+
for (const u of h) {
|
|
1052
|
+
const w = \`\${t}/\${u.name}\`, f = \`\${r}/\${u.name}\`;
|
|
1053
|
+
await this.copy(w, f, { recursive: !0, force: a });
|
|
1053
1054
|
}
|
|
1054
1055
|
}
|
|
1055
|
-
this.
|
|
1056
|
-
} catch (
|
|
1057
|
-
throw
|
|
1056
|
+
await this.notifyChange({ path: r, type: "added", isDirectory: !1 });
|
|
1057
|
+
} catch (i) {
|
|
1058
|
+
throw i instanceof c ? i : new c(\`Failed to copy from \${t} to \${r}\`, "CP_FAILED");
|
|
1058
1059
|
}
|
|
1059
1060
|
}
|
|
1060
1061
|
/**
|
|
1061
1062
|
* Start watching a file or directory for changes
|
|
1062
1063
|
*/
|
|
1063
|
-
async watch(
|
|
1064
|
+
async watch(t) {
|
|
1064
1065
|
await this.ensureMounted();
|
|
1065
|
-
const r = C(
|
|
1066
|
-
this.watchers.set(r,
|
|
1066
|
+
const r = C(t), n = await this.buildSnapshot(r);
|
|
1067
|
+
this.watchers.set(r, n), this.watchTimer || (this.watchTimer = setInterval(() => {
|
|
1067
1068
|
this.scanWatches();
|
|
1068
|
-
}, this.watchInterval));
|
|
1069
|
+
}, this.options.watchInterval));
|
|
1069
1070
|
}
|
|
1070
1071
|
/**
|
|
1071
1072
|
* Stop watching a previously watched path
|
|
1072
1073
|
*/
|
|
1073
|
-
unwatch(
|
|
1074
|
-
const r = C(
|
|
1074
|
+
unwatch(t) {
|
|
1075
|
+
const r = C(t);
|
|
1075
1076
|
this.watchers.delete(r), this.watchers.size === 0 && this.watchTimer && (clearInterval(this.watchTimer), this.watchTimer = null);
|
|
1076
1077
|
}
|
|
1077
|
-
async buildSnapshot(
|
|
1078
|
-
const r = /* @__PURE__ */ new Map(),
|
|
1079
|
-
const
|
|
1080
|
-
if (r.set(
|
|
1081
|
-
const
|
|
1082
|
-
for (const
|
|
1083
|
-
const l = \`\${
|
|
1084
|
-
await
|
|
1078
|
+
async buildSnapshot(t) {
|
|
1079
|
+
const r = /* @__PURE__ */ new Map(), n = async (i) => {
|
|
1080
|
+
const a = await this.stat(i);
|
|
1081
|
+
if (r.set(i, a), a.isDirectory) {
|
|
1082
|
+
const s = await this.readdir(i, { withFileTypes: !0 });
|
|
1083
|
+
for (const o of s) {
|
|
1084
|
+
const l = \`\${i === "/" ? "" : i}/\${o.name}\`;
|
|
1085
|
+
await n(l);
|
|
1085
1086
|
}
|
|
1086
1087
|
}
|
|
1087
1088
|
};
|
|
1088
|
-
return await
|
|
1089
|
+
return await n(t), r;
|
|
1089
1090
|
}
|
|
1090
1091
|
async scanWatches() {
|
|
1091
1092
|
if (!this.scanning) {
|
|
1092
1093
|
this.scanning = !0;
|
|
1093
1094
|
try {
|
|
1094
1095
|
await Promise.all(
|
|
1095
|
-
[...this.watchers.entries()].map(async ([
|
|
1096
|
-
let
|
|
1096
|
+
[...this.watchers.entries()].map(async ([t, r]) => {
|
|
1097
|
+
let n;
|
|
1097
1098
|
try {
|
|
1098
|
-
|
|
1099
|
+
n = await this.buildSnapshot(t);
|
|
1099
1100
|
} catch {
|
|
1100
|
-
|
|
1101
|
+
n = /* @__PURE__ */ new Map();
|
|
1101
1102
|
}
|
|
1102
|
-
const n
|
|
1103
|
-
for (const [i, o] of a) {
|
|
1103
|
+
for (const [i, a] of n) {
|
|
1104
1104
|
const s = r.get(i);
|
|
1105
|
-
s ? (s.mtime !==
|
|
1105
|
+
s ? (s.mtime !== a.mtime || s.size !== a.size) && await this.notifyChange({ path: i, type: "changed", isDirectory: !1 }) : await this.notifyChange({ path: i, type: "added", isDirectory: !1 });
|
|
1106
1106
|
}
|
|
1107
1107
|
for (const i of r.keys())
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
for (const i of n)
|
|
1111
|
-
this.watchCallback(i);
|
|
1112
|
-
this.watchers.set(e, a);
|
|
1108
|
+
n.has(i) || await this.notifyChange({ path: i, type: "removed", isDirectory: !1 });
|
|
1109
|
+
this.watchers.set(t, n);
|
|
1113
1110
|
})
|
|
1114
1111
|
);
|
|
1115
1112
|
} finally {
|
|
@@ -1145,72 +1142,75 @@ class we {
|
|
|
1145
1142
|
* await fs.sync(entries, { cleanBefore: true });
|
|
1146
1143
|
* \`\`\`
|
|
1147
1144
|
*/
|
|
1148
|
-
async sync(
|
|
1145
|
+
async sync(t, r) {
|
|
1149
1146
|
await this.ensureMounted();
|
|
1150
1147
|
try {
|
|
1151
1148
|
(r?.cleanBefore ?? !1) && await this.clear("/");
|
|
1152
|
-
for (const [
|
|
1153
|
-
const
|
|
1154
|
-
let
|
|
1155
|
-
|
|
1149
|
+
for (const [i, a] of t) {
|
|
1150
|
+
const s = C(i);
|
|
1151
|
+
let o;
|
|
1152
|
+
a instanceof Blob ? o = await ft(a) : o = a, await this.writeFile(s, o);
|
|
1156
1153
|
}
|
|
1157
|
-
this.
|
|
1158
|
-
} catch (
|
|
1159
|
-
throw
|
|
1154
|
+
await this.notifyChange({ path: "/", type: "changed", isDirectory: !0 });
|
|
1155
|
+
} catch (n) {
|
|
1156
|
+
throw n instanceof c ? n : new c("Failed to sync file system", "SYNC_FAILED");
|
|
1160
1157
|
}
|
|
1161
1158
|
}
|
|
1162
1159
|
}
|
|
1163
|
-
typeof self < "u" && self.constructor.name === "DedicatedWorkerGlobalScope" &&
|
|
1164
|
-
//# sourceMappingURL=worker-
|
|
1160
|
+
typeof self < "u" && self.constructor.name === "DedicatedWorkerGlobalScope" && I(new wt());
|
|
1161
|
+
//# sourceMappingURL=worker-CHy3JxL1.js.map
|
|
1165
1162
|
`, r = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", a], { type: "text/javascript;charset=utf-8" });
|
|
1166
|
-
function s(
|
|
1163
|
+
function s(e) {
|
|
1167
1164
|
let n;
|
|
1168
1165
|
try {
|
|
1169
1166
|
if (n = r && (self.URL || self.webkitURL).createObjectURL(r), !n) throw "";
|
|
1170
|
-
const
|
|
1167
|
+
const t = new Worker(n, {
|
|
1171
1168
|
type: "module",
|
|
1172
|
-
name:
|
|
1169
|
+
name: e?.name
|
|
1173
1170
|
});
|
|
1174
|
-
return
|
|
1171
|
+
return t.addEventListener("error", () => {
|
|
1175
1172
|
(self.URL || self.webkitURL).revokeObjectURL(n);
|
|
1176
|
-
}),
|
|
1173
|
+
}), t;
|
|
1177
1174
|
} catch {
|
|
1178
1175
|
return new Worker(
|
|
1179
1176
|
"data:text/javascript;charset=utf-8," + encodeURIComponent(a),
|
|
1180
1177
|
{
|
|
1181
1178
|
type: "module",
|
|
1182
|
-
name:
|
|
1179
|
+
name: e?.name
|
|
1183
1180
|
}
|
|
1184
1181
|
);
|
|
1185
1182
|
}
|
|
1186
1183
|
}
|
|
1187
|
-
function
|
|
1188
|
-
const
|
|
1189
|
-
return
|
|
1184
|
+
function h(e, n) {
|
|
1185
|
+
const t = i(new s());
|
|
1186
|
+
return e && t.setWatchCallback(
|
|
1187
|
+
e ? o(e) : () => {
|
|
1188
|
+
}
|
|
1189
|
+
), n && t.setOptions(n), t;
|
|
1190
1190
|
}
|
|
1191
1191
|
export {
|
|
1192
1192
|
d as DirectoryNotFoundError,
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1193
|
+
p as FileNotFoundError,
|
|
1194
|
+
u as OPFSError,
|
|
1195
|
+
y as OPFSNotMountedError,
|
|
1196
|
+
w as OPFSNotSupportedError,
|
|
1197
1197
|
m as PathError,
|
|
1198
1198
|
g as PermissionError,
|
|
1199
1199
|
v as StorageError,
|
|
1200
|
-
|
|
1200
|
+
F as TimeoutError,
|
|
1201
1201
|
S as basename,
|
|
1202
|
-
|
|
1202
|
+
E as calculateFileHash,
|
|
1203
1203
|
b as checkOPFSSupport,
|
|
1204
1204
|
P as convertBlobToUint8Array,
|
|
1205
1205
|
x as createBuffer,
|
|
1206
|
-
|
|
1206
|
+
h as createWorker,
|
|
1207
1207
|
T as decodeBuffer,
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1208
|
+
A as dirname,
|
|
1209
|
+
O as encodeString,
|
|
1210
|
+
D as extname,
|
|
1211
1211
|
_ as joinPath,
|
|
1212
|
-
|
|
1213
|
-
|
|
1212
|
+
I as normalizePath,
|
|
1213
|
+
C as readFileData,
|
|
1214
1214
|
k as resolvePath,
|
|
1215
1215
|
U as splitPath,
|
|
1216
1216
|
R as writeFileData
|