opfs-worker 0.3.0 → 0.3.2
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 +6 -7
- package/dist/assets/worker-CLK22qZk.js.map +1 -0
- package/dist/helpers-B87wz5kv.cjs +2 -0
- package/dist/helpers-B87wz5kv.cjs.map +1 -0
- package/dist/{helpers-C0nyU6hv.js → helpers-DxFcNkZe.js} +51 -51
- package/dist/helpers-DxFcNkZe.js.map +1 -0
- package/dist/index.cjs +219 -208
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +228 -217
- package/dist/index.js.map +1 -1
- package/dist/raw.cjs +1 -1
- package/dist/raw.cjs.map +1 -1
- package/dist/raw.js +43 -32
- package/dist/raw.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/helpers.d.ts +9 -0
- package/dist/utils/helpers.d.ts.map +1 -1
- package/dist/worker.d.ts +4 -16
- package/dist/worker.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/assets/worker-DvdTp4yb.js.map +0 -1
- package/dist/helpers-C0nyU6hv.js.map +0 -1
- package/dist/helpers-FvdHLObV.cjs +0 -2
- package/dist/helpers-FvdHLObV.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("comlink"),n=require("./helpers-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("comlink"),n=require("./helpers-B87wz5kv.cjs"),i=`/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
const H = Symbol("Comlink.proxy"), R = Symbol("Comlink.endpoint"), B = Symbol("Comlink.releaseProxy"),
|
|
6
|
+
const H = Symbol("Comlink.proxy"), R = Symbol("Comlink.endpoint"), B = Symbol("Comlink.releaseProxy"), C = Symbol("Comlink.finalizer"), p = Symbol("Comlink.thrown"), $ = (e) => typeof e == "object" && e !== null || typeof e == "function", W = {
|
|
7
7
|
canHandle: (e) => $(e) && e[H],
|
|
8
8
|
serialize(e) {
|
|
9
9
|
const { port1: t, port2: r } = new MessageChannel();
|
|
10
|
-
return
|
|
10
|
+
return x(e, t), [r, [r]];
|
|
11
11
|
},
|
|
12
12
|
deserialize(e) {
|
|
13
13
|
return e.start(), Y(e);
|
|
14
14
|
}
|
|
15
15
|
}, j = {
|
|
16
|
-
canHandle: (e) => $(e) &&
|
|
16
|
+
canHandle: (e) => $(e) && p in e,
|
|
17
17
|
serialize({ value: e }) {
|
|
18
18
|
let t;
|
|
19
19
|
return e instanceof Error ? t = {
|
|
@@ -38,15 +38,15 @@ function V(e, t) {
|
|
|
38
38
|
return !0;
|
|
39
39
|
return !1;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
t.addEventListener("message", function n
|
|
43
|
-
if (!
|
|
41
|
+
function x(e, t = globalThis, r = ["*"]) {
|
|
42
|
+
t.addEventListener("message", function i(n) {
|
|
43
|
+
if (!n || !n.data)
|
|
44
44
|
return;
|
|
45
|
-
if (!V(r,
|
|
46
|
-
console.warn(\`Invalid origin '\${
|
|
45
|
+
if (!V(r, n.origin)) {
|
|
46
|
+
console.warn(\`Invalid origin '\${n.origin}' for comlink proxy\`);
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
const { id: a, type: s, path: o } = Object.assign({ path: [] },
|
|
49
|
+
const { id: a, type: s, path: o } = Object.assign({ path: [] }, n.data), l = (n.data.argumentList || []).map(d);
|
|
50
50
|
let h;
|
|
51
51
|
try {
|
|
52
52
|
const u = o.slice(0, -1).reduce((f, g) => f[g], e), w = o.reduce((f, g) => f[g], e);
|
|
@@ -55,7 +55,7 @@ function I(e, t = globalThis, r = ["*"]) {
|
|
|
55
55
|
h = w;
|
|
56
56
|
break;
|
|
57
57
|
case "SET":
|
|
58
|
-
u[o.slice(-1)[0]] = d(
|
|
58
|
+
u[o.slice(-1)[0]] = d(n.data.value), h = !0;
|
|
59
59
|
break;
|
|
60
60
|
case "APPLY":
|
|
61
61
|
h = w.apply(u, l);
|
|
@@ -69,7 +69,7 @@ function I(e, t = globalThis, r = ["*"]) {
|
|
|
69
69
|
case "ENDPOINT":
|
|
70
70
|
{
|
|
71
71
|
const { port1: f, port2: g } = new MessageChannel();
|
|
72
|
-
|
|
72
|
+
x(e, g), h = J(f, [f]);
|
|
73
73
|
}
|
|
74
74
|
break;
|
|
75
75
|
case "RELEASE":
|
|
@@ -79,15 +79,15 @@ function I(e, t = globalThis, r = ["*"]) {
|
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
} catch (u) {
|
|
82
|
-
h = { value: u, [
|
|
82
|
+
h = { value: u, [p]: 0 };
|
|
83
83
|
}
|
|
84
|
-
Promise.resolve(h).catch((u) => ({ value: u, [
|
|
85
|
-
const [w, f] =
|
|
86
|
-
t.postMessage(Object.assign(Object.assign({}, w), { id: a }), f), s === "RELEASE" && (t.removeEventListener("message",
|
|
84
|
+
Promise.resolve(h).catch((u) => ({ value: u, [p]: 0 })).then((u) => {
|
|
85
|
+
const [w, f] = A(u);
|
|
86
|
+
t.postMessage(Object.assign(Object.assign({}, w), { id: a }), f), s === "RELEASE" && (t.removeEventListener("message", i), L(t), C in e && typeof e[C] == "function" && e[C]());
|
|
87
87
|
}).catch((u) => {
|
|
88
|
-
const [w, f] =
|
|
88
|
+
const [w, f] = A({
|
|
89
89
|
value: new TypeError("Unserializable return value"),
|
|
90
|
-
[
|
|
90
|
+
[p]: 0
|
|
91
91
|
});
|
|
92
92
|
t.postMessage(Object.assign(Object.assign({}, w), { id: a }), f);
|
|
93
93
|
});
|
|
@@ -101,8 +101,8 @@ function L(e) {
|
|
|
101
101
|
}
|
|
102
102
|
function Y(e, t) {
|
|
103
103
|
const r = /* @__PURE__ */ new Map();
|
|
104
|
-
return e.addEventListener("message", function(
|
|
105
|
-
const { data: a } =
|
|
104
|
+
return e.addEventListener("message", function(n) {
|
|
105
|
+
const { data: a } = n;
|
|
106
106
|
if (!a || !a.id)
|
|
107
107
|
return;
|
|
108
108
|
const s = r.get(a.id);
|
|
@@ -112,9 +112,9 @@ function Y(e, t) {
|
|
|
112
112
|
} finally {
|
|
113
113
|
r.delete(a.id);
|
|
114
114
|
}
|
|
115
|
-
}),
|
|
115
|
+
}), M(e, r, [], t);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function E(e) {
|
|
118
118
|
if (e)
|
|
119
119
|
throw new Error("Proxy has been released and is not useable");
|
|
120
120
|
}
|
|
@@ -125,25 +125,25 @@ function U(e) {
|
|
|
125
125
|
L(e);
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
|
-
const
|
|
129
|
-
const t = (
|
|
130
|
-
|
|
128
|
+
const S = /* @__PURE__ */ new WeakMap(), D = "FinalizationRegistry" in globalThis && new FinalizationRegistry((e) => {
|
|
129
|
+
const t = (S.get(e) || 0) - 1;
|
|
130
|
+
S.set(e, t), t === 0 && U(e);
|
|
131
131
|
});
|
|
132
132
|
function X(e, t) {
|
|
133
|
-
const r = (
|
|
134
|
-
|
|
133
|
+
const r = (S.get(t) || 0) + 1;
|
|
134
|
+
S.set(t, r), D && D.register(e, t, e);
|
|
135
135
|
}
|
|
136
136
|
function q(e) {
|
|
137
|
-
|
|
137
|
+
D && D.unregister(e);
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function M(e, t, r = [], i = function() {
|
|
140
140
|
}) {
|
|
141
|
-
let
|
|
142
|
-
const a = new Proxy(
|
|
141
|
+
let n = !1;
|
|
142
|
+
const a = new Proxy(i, {
|
|
143
143
|
get(s, o) {
|
|
144
|
-
if (
|
|
144
|
+
if (E(n), o === B)
|
|
145
145
|
return () => {
|
|
146
|
-
q(a), U(e), t.clear(),
|
|
146
|
+
q(a), U(e), t.clear(), n = !0;
|
|
147
147
|
};
|
|
148
148
|
if (o === "then") {
|
|
149
149
|
if (r.length === 0)
|
|
@@ -154,11 +154,11 @@ function x(e, t, r = [], n = function() {
|
|
|
154
154
|
}).then(d);
|
|
155
155
|
return l.then.bind(l);
|
|
156
156
|
}
|
|
157
|
-
return
|
|
157
|
+
return M(e, t, [...r, o]);
|
|
158
158
|
},
|
|
159
159
|
set(s, o, l) {
|
|
160
|
-
|
|
161
|
-
const [h, u] =
|
|
160
|
+
E(n);
|
|
161
|
+
const [h, u] = A(l);
|
|
162
162
|
return y(e, t, {
|
|
163
163
|
type: "SET",
|
|
164
164
|
path: [...r, o].map((w) => w.toString()),
|
|
@@ -166,14 +166,14 @@ function x(e, t, r = [], n = function() {
|
|
|
166
166
|
}, u).then(d);
|
|
167
167
|
},
|
|
168
168
|
apply(s, o, l) {
|
|
169
|
-
|
|
169
|
+
E(n);
|
|
170
170
|
const h = r[r.length - 1];
|
|
171
171
|
if (h === R)
|
|
172
172
|
return y(e, t, {
|
|
173
173
|
type: "ENDPOINT"
|
|
174
174
|
}).then(d);
|
|
175
175
|
if (h === "bind")
|
|
176
|
-
return
|
|
176
|
+
return M(e, t, r.slice(0, -1));
|
|
177
177
|
const [u, w] = v(l);
|
|
178
178
|
return y(e, t, {
|
|
179
179
|
type: "APPLY",
|
|
@@ -182,7 +182,7 @@ function x(e, t, r = [], n = function() {
|
|
|
182
182
|
}, w).then(d);
|
|
183
183
|
},
|
|
184
184
|
construct(s, o) {
|
|
185
|
-
|
|
185
|
+
E(n);
|
|
186
186
|
const [l, h] = v(o);
|
|
187
187
|
return y(e, t, {
|
|
188
188
|
type: "CONSTRUCT",
|
|
@@ -197,7 +197,7 @@ function K(e) {
|
|
|
197
197
|
return Array.prototype.concat.apply([], e);
|
|
198
198
|
}
|
|
199
199
|
function v(e) {
|
|
200
|
-
const t = e.map(
|
|
200
|
+
const t = e.map(A);
|
|
201
201
|
return [t.map((r) => r[0]), K(t.map((r) => r[1]))];
|
|
202
202
|
}
|
|
203
203
|
const _ = /* @__PURE__ */ new WeakMap();
|
|
@@ -207,17 +207,17 @@ function J(e, t) {
|
|
|
207
207
|
function Q(e) {
|
|
208
208
|
return Object.assign(e, { [H]: !0 });
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function A(e) {
|
|
211
211
|
for (const [t, r] of z)
|
|
212
212
|
if (r.canHandle(e)) {
|
|
213
|
-
const [
|
|
213
|
+
const [i, n] = r.serialize(e);
|
|
214
214
|
return [
|
|
215
215
|
{
|
|
216
216
|
type: "HANDLER",
|
|
217
217
|
name: t,
|
|
218
|
-
value:
|
|
218
|
+
value: i
|
|
219
219
|
},
|
|
220
|
-
|
|
220
|
+
n
|
|
221
221
|
];
|
|
222
222
|
}
|
|
223
223
|
return [
|
|
@@ -236,18 +236,18 @@ function d(e) {
|
|
|
236
236
|
return e.value;
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
function y(e, t, r,
|
|
240
|
-
return new Promise((
|
|
239
|
+
function y(e, t, r, i) {
|
|
240
|
+
return new Promise((n) => {
|
|
241
241
|
const a = Z();
|
|
242
|
-
t.set(a,
|
|
242
|
+
t.set(a, n), e.start && e.start(), e.postMessage(Object.assign({ id: a }, r), i);
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
245
|
function Z() {
|
|
246
246
|
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
|
|
247
247
|
}
|
|
248
248
|
class c extends Error {
|
|
249
|
-
constructor(t, r,
|
|
250
|
-
super(t), this.code = r, this.path =
|
|
249
|
+
constructor(t, r, i) {
|
|
250
|
+
super(t), this.code = r, this.path = i, this.name = "OPFSError";
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
class tt extends c {
|
|
@@ -255,7 +255,7 @@ class tt extends c {
|
|
|
255
255
|
super("OPFS is not supported in this browser", "OPFS_NOT_SUPPORTED");
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
|
-
class
|
|
258
|
+
class b extends c {
|
|
259
259
|
constructor() {
|
|
260
260
|
super("OPFS is not mounted", "OPFS_NOT_MOUNTED");
|
|
261
261
|
}
|
|
@@ -265,7 +265,7 @@ class N extends c {
|
|
|
265
265
|
super(t, "INVALID_PATH", r);
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
|
-
class
|
|
268
|
+
class T extends c {
|
|
269
269
|
constructor(t) {
|
|
270
270
|
super(\`File not found: \${t}\`, "FILE_NOT_FOUND", t);
|
|
271
271
|
}
|
|
@@ -321,8 +321,8 @@ function rt(e, t = "utf-8") {
|
|
|
321
321
|
function nt(e) {
|
|
322
322
|
const t = new Uint8Array(e.length * 2);
|
|
323
323
|
for (let r = 0; r < e.length; r++) {
|
|
324
|
-
const
|
|
325
|
-
t[r * 2] =
|
|
324
|
+
const i = e.charCodeAt(r);
|
|
325
|
+
t[r * 2] = i & 255, t[r * 2 + 1] = i >> 8;
|
|
326
326
|
}
|
|
327
327
|
return t;
|
|
328
328
|
}
|
|
@@ -348,33 +348,33 @@ function ot() {
|
|
|
348
348
|
throw new tt();
|
|
349
349
|
}
|
|
350
350
|
function m(e) {
|
|
351
|
-
return Array.isArray(e) ? e : e.split("/").filter(Boolean);
|
|
351
|
+
return Array.isArray(e) ? e : (e.startsWith("~/") ? e.slice(2) : e).split("/").filter(Boolean);
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function I(e) {
|
|
354
354
|
return typeof e == "string" ? e ?? "/" : \`/\${e.join("/")}\`;
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function O(e) {
|
|
357
357
|
const t = m(e);
|
|
358
358
|
return t[t.length - 1] || "";
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function P(e) {
|
|
361
361
|
const t = m(e);
|
|
362
|
-
return t.pop(),
|
|
362
|
+
return t.pop(), I(t);
|
|
363
363
|
}
|
|
364
|
-
function
|
|
365
|
-
return !e || e === "/" ? "/" : e.startsWith("/") ? e : \`/\${e}\`;
|
|
364
|
+
function F(e) {
|
|
365
|
+
return !e || e === "/" ? "/" : e.startsWith("~/") ? \`/\${e.slice(2)}\` : e.startsWith("/") ? e : \`/\${e}\`;
|
|
366
366
|
}
|
|
367
367
|
function ct(e) {
|
|
368
|
-
const t =
|
|
369
|
-
for (const n of
|
|
368
|
+
const t = F(e), r = m(t), i = [];
|
|
369
|
+
for (const n of r)
|
|
370
370
|
if (!(n === "." || n === ""))
|
|
371
371
|
if (n === "..") {
|
|
372
|
-
if (
|
|
372
|
+
if (i.length === 0)
|
|
373
373
|
continue;
|
|
374
|
-
|
|
374
|
+
i.pop();
|
|
375
375
|
} else
|
|
376
|
-
|
|
377
|
-
return
|
|
376
|
+
i.push(n);
|
|
377
|
+
return I(i);
|
|
378
378
|
}
|
|
379
379
|
function lt(e, t = "utf-8") {
|
|
380
380
|
return typeof e == "string" ? et(e, t) : e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
@@ -382,26 +382,26 @@ function lt(e, t = "utf-8") {
|
|
|
382
382
|
async function ht(e) {
|
|
383
383
|
const t = await e.createSyncAccessHandle();
|
|
384
384
|
try {
|
|
385
|
-
const r = t.getSize(),
|
|
386
|
-
return t.read(
|
|
385
|
+
const r = t.getSize(), i = new Uint8Array(r);
|
|
386
|
+
return t.read(i, { at: 0 }), i;
|
|
387
387
|
} finally {
|
|
388
388
|
t.close();
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
async function k(e, t, r,
|
|
392
|
-
let
|
|
391
|
+
async function k(e, t, r, i = {}) {
|
|
392
|
+
let n = null;
|
|
393
393
|
try {
|
|
394
|
-
|
|
395
|
-
const a = lt(t, r), s =
|
|
396
|
-
|
|
394
|
+
n = await e.createSyncAccessHandle();
|
|
395
|
+
const a = lt(t, r), s = i.append ? n.getSize() : 0;
|
|
396
|
+
n.write(a, { at: s }), i.truncate && !i.append && n.truncate(a.byteLength), n.flush();
|
|
397
397
|
} catch (a) {
|
|
398
398
|
console.error(a);
|
|
399
|
-
const s =
|
|
399
|
+
const s = i.append ? "append" : "write";
|
|
400
400
|
throw new c(\`Failed to \${s} file\`, \`\${s.toUpperCase()}_FAILED\`);
|
|
401
401
|
} finally {
|
|
402
|
-
if (
|
|
402
|
+
if (n)
|
|
403
403
|
try {
|
|
404
|
-
|
|
404
|
+
n.close();
|
|
405
405
|
} catch {
|
|
406
406
|
}
|
|
407
407
|
}
|
|
@@ -409,8 +409,8 @@ async function k(e, t, r, n = {}) {
|
|
|
409
409
|
async function ut(e, t = "SHA-1", r = 50 * 1024 * 1024) {
|
|
410
410
|
if (e instanceof File && (e = await e.arrayBuffer()), e.byteLength > r)
|
|
411
411
|
throw new Error(\`File size \${e.byteLength} bytes exceeds maximum allowed size \${r} bytes\`);
|
|
412
|
-
const
|
|
413
|
-
return Array.from(new Uint8Array(
|
|
412
|
+
const i = new Uint8Array(e), n = await crypto.subtle.digest(t, i);
|
|
413
|
+
return Array.from(new Uint8Array(n)).map((s) => s.toString(16).padStart(2, "0")).join("");
|
|
414
414
|
}
|
|
415
415
|
async function ft(e) {
|
|
416
416
|
const t = await e.arrayBuffer();
|
|
@@ -451,21 +451,22 @@ class wt {
|
|
|
451
451
|
let r;
|
|
452
452
|
if (this.options.hashAlgorithm && !t.isDirectory && t.type !== "removed")
|
|
453
453
|
try {
|
|
454
|
-
const
|
|
455
|
-
|
|
456
|
-
} catch (
|
|
457
|
-
console.warn(\`Failed to calculate hash for \${t.path}:\`,
|
|
454
|
+
const i = await this.stat(t.path);
|
|
455
|
+
i.isFile && i.hash && (r = i.hash);
|
|
456
|
+
} catch (i) {
|
|
457
|
+
console.warn(\`Failed to calculate hash for \${t.path}:\`, i);
|
|
458
458
|
}
|
|
459
459
|
try {
|
|
460
460
|
this.broadcastChannel || (this.broadcastChannel = new BroadcastChannel(this.options.broadcastChannel));
|
|
461
|
-
const
|
|
461
|
+
const i = {
|
|
462
|
+
root: this.root.name,
|
|
462
463
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
463
464
|
...t,
|
|
464
465
|
...r && { hash: r }
|
|
465
466
|
};
|
|
466
|
-
this.broadcastChannel.postMessage(
|
|
467
|
-
} catch (
|
|
468
|
-
console.warn("Failed to send event via BroadcastChannel:",
|
|
467
|
+
this.broadcastChannel.postMessage(i);
|
|
468
|
+
} catch (i) {
|
|
469
|
+
console.warn("Failed to send event via BroadcastChannel:", i);
|
|
469
470
|
}
|
|
470
471
|
}
|
|
471
472
|
/**
|
|
@@ -502,13 +503,13 @@ class wt {
|
|
|
502
503
|
* \`\`\`
|
|
503
504
|
*/
|
|
504
505
|
async mount(t = "/") {
|
|
505
|
-
return this.mountingPromise && await this.mountingPromise, this.mountingPromise = new Promise(async (r,
|
|
506
|
+
return this.mountingPromise && await this.mountingPromise, this.mountingPromise = new Promise(async (r, i) => {
|
|
506
507
|
this.root = null;
|
|
507
508
|
try {
|
|
508
|
-
const
|
|
509
|
-
t === "/" ? this.root =
|
|
510
|
-
} catch (
|
|
511
|
-
console.error(
|
|
509
|
+
const n = await navigator.storage.getDirectory();
|
|
510
|
+
t === "/" ? this.root = n : this.root = await this.getDirectoryHandle(t, !0, n), r(!0);
|
|
511
|
+
} catch (n) {
|
|
512
|
+
console.error(n), i(new c("Failed to initialize OPFS", "INIT_FAILED"));
|
|
512
513
|
} finally {
|
|
513
514
|
this.mountingPromise = null;
|
|
514
515
|
}
|
|
@@ -562,12 +563,12 @@ class wt {
|
|
|
562
563
|
* const docsDir2 = await fs.getDirectoryHandle(['users', 'john', 'documents'], true);
|
|
563
564
|
* \`\`\`
|
|
564
565
|
*/
|
|
565
|
-
async getDirectoryHandle(t, r = !1,
|
|
566
|
-
if (!
|
|
567
|
-
throw new
|
|
568
|
-
const
|
|
569
|
-
let a =
|
|
570
|
-
for (const s of
|
|
566
|
+
async getDirectoryHandle(t, r = !1, i = this.root) {
|
|
567
|
+
if (!i)
|
|
568
|
+
throw new b();
|
|
569
|
+
const n = Array.isArray(t) ? t : m(t);
|
|
570
|
+
let a = i;
|
|
571
|
+
for (const s of n)
|
|
571
572
|
a = await a.getDirectoryHandle(s, { create: r });
|
|
572
573
|
return a;
|
|
573
574
|
}
|
|
@@ -590,14 +591,14 @@ class wt {
|
|
|
590
591
|
* const fileHandle2 = await fs.getFileHandle(['config', 'settings.json'], true);
|
|
591
592
|
* \`\`\`
|
|
592
593
|
*/
|
|
593
|
-
async getFileHandle(t, r = !1,
|
|
594
|
-
if (!
|
|
595
|
-
throw new
|
|
596
|
-
const
|
|
597
|
-
if (
|
|
594
|
+
async getFileHandle(t, r = !1, i = this.root) {
|
|
595
|
+
if (!i)
|
|
596
|
+
throw new b();
|
|
597
|
+
const n = m(t);
|
|
598
|
+
if (n.length === 0)
|
|
598
599
|
throw new N("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
|
|
599
|
-
const a =
|
|
600
|
-
return (await this.getDirectoryHandle(
|
|
600
|
+
const a = n.pop();
|
|
601
|
+
return (await this.getDirectoryHandle(n, r, i)).getFileHandle(a, { create: r });
|
|
601
602
|
}
|
|
602
603
|
/**
|
|
603
604
|
* Get a complete index of all files and directories in the file system
|
|
@@ -619,10 +620,10 @@ class wt {
|
|
|
619
620
|
* \`\`\`
|
|
620
621
|
*/
|
|
621
622
|
async index() {
|
|
622
|
-
const t = /* @__PURE__ */ new Map(), r = async (
|
|
623
|
-
const
|
|
624
|
-
for (const a of
|
|
625
|
-
const s = \`\${
|
|
623
|
+
const t = /* @__PURE__ */ new Map(), r = async (i) => {
|
|
624
|
+
const n = await this.readDir(i);
|
|
625
|
+
for (const a of n) {
|
|
626
|
+
const s = \`\${i === "/" ? "" : i}/\${a.name}\`;
|
|
626
627
|
try {
|
|
627
628
|
const o = await this.stat(s);
|
|
628
629
|
t.set(s, o), o.isDirectory && await r(s);
|
|
@@ -643,10 +644,10 @@ class wt {
|
|
|
643
644
|
async readFile(t, r = "utf-8") {
|
|
644
645
|
await this.ensureMounted();
|
|
645
646
|
try {
|
|
646
|
-
const
|
|
647
|
-
return r === "binary" ?
|
|
648
|
-
} catch (
|
|
649
|
-
throw console.error(
|
|
647
|
+
const i = await this.getFileHandle(t, !1), n = await ht(i);
|
|
648
|
+
return r === "binary" ? n : rt(n, r);
|
|
649
|
+
} catch (i) {
|
|
650
|
+
throw console.error(i), new T(t);
|
|
650
651
|
}
|
|
651
652
|
}
|
|
652
653
|
/**
|
|
@@ -674,10 +675,10 @@ class wt {
|
|
|
674
675
|
* await fs.writeFile('/data/utf16.txt', 'Hello World', 'utf-16le');
|
|
675
676
|
* \`\`\`
|
|
676
677
|
*/
|
|
677
|
-
async writeFile(t, r,
|
|
678
|
+
async writeFile(t, r, i) {
|
|
678
679
|
await this.ensureMounted();
|
|
679
|
-
const
|
|
680
|
-
await k(
|
|
680
|
+
const n = await this.getFileHandle(t, !0);
|
|
681
|
+
await k(n, r, i, { truncate: !0 }), await this.notifyChange({ path: t, type: "changed", isDirectory: !1 });
|
|
681
682
|
}
|
|
682
683
|
/**
|
|
683
684
|
* Append data to a file
|
|
@@ -701,10 +702,10 @@ class wt {
|
|
|
701
702
|
* await fs.appendFile('/data/binary.dat', additionalData);
|
|
702
703
|
* \`\`\`
|
|
703
704
|
*/
|
|
704
|
-
async appendFile(t, r,
|
|
705
|
+
async appendFile(t, r, i) {
|
|
705
706
|
await this.ensureMounted();
|
|
706
|
-
const
|
|
707
|
-
await k(
|
|
707
|
+
const n = await this.getFileHandle(t, !0);
|
|
708
|
+
await k(n, r, i, { append: !0 }), await this.notifyChange({ path: t, type: "changed", isDirectory: !1 });
|
|
708
709
|
}
|
|
709
710
|
/**
|
|
710
711
|
* Create a directory
|
|
@@ -729,16 +730,16 @@ class wt {
|
|
|
729
730
|
*/
|
|
730
731
|
async mkdir(t, r) {
|
|
731
732
|
if (await this.ensureMounted(), !this.root)
|
|
732
|
-
throw new
|
|
733
|
-
const
|
|
733
|
+
throw new b();
|
|
734
|
+
const i = r?.recursive ?? !1, n = m(t);
|
|
734
735
|
let a = this.root;
|
|
735
|
-
for (let s = 0; s <
|
|
736
|
-
const o =
|
|
736
|
+
for (let s = 0; s < n.length; s++) {
|
|
737
|
+
const o = n[s];
|
|
737
738
|
try {
|
|
738
|
-
a = await a.getDirectoryHandle(o, { create:
|
|
739
|
+
a = await a.getDirectoryHandle(o, { create: i || s === n.length - 1 });
|
|
739
740
|
} catch (l) {
|
|
740
741
|
throw l.name === "NotFoundError" ? new c(
|
|
741
|
-
\`Parent directory does not exist: \${
|
|
742
|
+
\`Parent directory does not exist: \${I(n.slice(0, s + 1))}\`,
|
|
742
743
|
"ENOENT"
|
|
743
744
|
) : l.name === "TypeMismatchError" ? new c(\`Path segment is not a directory: \${o}\`, "ENOTDIR") : new c("Failed to create directory", "MKDIR_FAILED");
|
|
744
745
|
}
|
|
@@ -777,9 +778,9 @@ class wt {
|
|
|
777
778
|
isFile: !1,
|
|
778
779
|
isDirectory: !0
|
|
779
780
|
};
|
|
780
|
-
const r =
|
|
781
|
+
const r = O(t), i = await this.getDirectoryHandle(P(t), !1), n = this.options.hashAlgorithm !== null;
|
|
781
782
|
try {
|
|
782
|
-
const s = await (await
|
|
783
|
+
const s = await (await i.getFileHandle(r, { create: !1 })).getFile(), o = {
|
|
783
784
|
kind: "file",
|
|
784
785
|
size: s.size,
|
|
785
786
|
mtime: new Date(s.lastModified).toISOString(),
|
|
@@ -787,7 +788,7 @@ class wt {
|
|
|
787
788
|
isFile: !0,
|
|
788
789
|
isDirectory: !1
|
|
789
790
|
};
|
|
790
|
-
if (
|
|
791
|
+
if (n && this.options.hashAlgorithm)
|
|
791
792
|
try {
|
|
792
793
|
const l = await ut(s, this.options.hashAlgorithm, this.options.maxFileSize);
|
|
793
794
|
o.hash = l;
|
|
@@ -800,7 +801,7 @@ class wt {
|
|
|
800
801
|
throw new c("Failed to stat (file)", "STAT_FAILED");
|
|
801
802
|
}
|
|
802
803
|
try {
|
|
803
|
-
return await
|
|
804
|
+
return await i.getDirectoryHandle(r, { create: !1 }), {
|
|
804
805
|
kind: "directory",
|
|
805
806
|
size: 0,
|
|
806
807
|
mtime: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
@@ -812,27 +813,37 @@ class wt {
|
|
|
812
813
|
throw a.name === "NotFoundError" ? new c(\`No such file or directory: \${t}\`, "ENOENT") : new c("Failed to stat (directory)", "STAT_FAILED");
|
|
813
814
|
}
|
|
814
815
|
}
|
|
815
|
-
|
|
816
|
+
/**
|
|
817
|
+
* Read a directory's contents
|
|
818
|
+
*
|
|
819
|
+
* Lists all files and subdirectories within the specified directory.
|
|
820
|
+
*
|
|
821
|
+
* @param path - The path to the directory to read
|
|
822
|
+
* @returns Promise that resolves to an array of detailed file/directory information
|
|
823
|
+
* @throws {OPFSError} If the directory does not exist or cannot be accessed
|
|
824
|
+
*
|
|
825
|
+
* @example
|
|
826
|
+
* \`\`\`typescript
|
|
827
|
+
* // Get detailed information about files and directories
|
|
828
|
+
* const detailed = await fs.readDir('/users/john/documents');
|
|
829
|
+
* detailed.forEach(item => {
|
|
830
|
+
* console.log(\`\${item.name} - \${item.isFile ? 'file' : 'directory'}\`);
|
|
831
|
+
* });
|
|
832
|
+
* \`\`\`
|
|
833
|
+
*/
|
|
834
|
+
async readDir(t) {
|
|
816
835
|
await this.ensureMounted();
|
|
817
|
-
const
|
|
818
|
-
|
|
819
|
-
const
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
a.
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
isDirectory: !l
|
|
827
|
-
});
|
|
828
|
-
}
|
|
829
|
-
return a;
|
|
830
|
-
} else {
|
|
831
|
-
const a = [];
|
|
832
|
-
for await (const [s] of i.entries())
|
|
833
|
-
a.push(s);
|
|
834
|
-
return a;
|
|
836
|
+
const r = await this.getDirectoryHandle(t, !1), i = [];
|
|
837
|
+
for await (const [n, a] of r.entries()) {
|
|
838
|
+
const s = a.kind === "file";
|
|
839
|
+
i.push({
|
|
840
|
+
name: n,
|
|
841
|
+
kind: a.kind,
|
|
842
|
+
isFile: s,
|
|
843
|
+
isDirectory: !s
|
|
844
|
+
});
|
|
835
845
|
}
|
|
846
|
+
return i;
|
|
836
847
|
}
|
|
837
848
|
/**
|
|
838
849
|
* Check if a file or directory exists
|
|
@@ -851,26 +862,26 @@ class wt {
|
|
|
851
862
|
async exists(t) {
|
|
852
863
|
if (await this.ensureMounted(), t === "/")
|
|
853
864
|
return !0;
|
|
854
|
-
const r =
|
|
855
|
-
let
|
|
865
|
+
const r = O(t);
|
|
866
|
+
let i = null;
|
|
856
867
|
try {
|
|
857
|
-
|
|
858
|
-
} catch (
|
|
859
|
-
throw (
|
|
868
|
+
i = await this.getDirectoryHandle(P(t), !1);
|
|
869
|
+
} catch (n) {
|
|
870
|
+
throw (n.name === "NotFoundError" || n.name === "TypeMismatchError") && (i = null), n;
|
|
860
871
|
}
|
|
861
|
-
if (!
|
|
872
|
+
if (!i || !r)
|
|
862
873
|
return !1;
|
|
863
874
|
try {
|
|
864
|
-
return await
|
|
865
|
-
} catch (
|
|
866
|
-
if (
|
|
867
|
-
throw
|
|
875
|
+
return await i.getFileHandle(r, { create: !1 }), !0;
|
|
876
|
+
} catch (n) {
|
|
877
|
+
if (n.name !== "NotFoundError" && n.name !== "TypeMismatchError")
|
|
878
|
+
throw n;
|
|
868
879
|
}
|
|
869
880
|
try {
|
|
870
|
-
return await
|
|
871
|
-
} catch (
|
|
872
|
-
if (
|
|
873
|
-
throw
|
|
881
|
+
return await i.getDirectoryHandle(r, { create: !1 }), !0;
|
|
882
|
+
} catch (n) {
|
|
883
|
+
if (n.name !== "NotFoundError" && n.name !== "TypeMismatchError")
|
|
884
|
+
throw n;
|
|
874
885
|
}
|
|
875
886
|
return !1;
|
|
876
887
|
}
|
|
@@ -896,10 +907,10 @@ class wt {
|
|
|
896
907
|
async clear(t = "/") {
|
|
897
908
|
await this.ensureMounted();
|
|
898
909
|
try {
|
|
899
|
-
const r = await this.
|
|
900
|
-
for (const
|
|
901
|
-
const
|
|
902
|
-
await this.remove(
|
|
910
|
+
const r = await this.readDir(t);
|
|
911
|
+
for (const i of r) {
|
|
912
|
+
const n = \`\${t === "/" ? "" : t}/\${i.name}\`;
|
|
913
|
+
await this.remove(n, { recursive: !0 });
|
|
903
914
|
}
|
|
904
915
|
await this.notifyChange({ path: t, type: "changed", isDirectory: !0 });
|
|
905
916
|
} catch (r) {
|
|
@@ -932,20 +943,20 @@ class wt {
|
|
|
932
943
|
*/
|
|
933
944
|
async remove(t, r) {
|
|
934
945
|
await this.ensureMounted();
|
|
935
|
-
const
|
|
946
|
+
const i = r?.recursive ?? !1, n = r?.force ?? !1;
|
|
936
947
|
if (t === "/")
|
|
937
948
|
throw new c("Cannot remove root directory", "EROOT");
|
|
938
|
-
const a =
|
|
949
|
+
const a = O(t);
|
|
939
950
|
if (!a)
|
|
940
951
|
throw new N("Invalid path", t);
|
|
941
|
-
const s = await this.getDirectoryHandle(
|
|
952
|
+
const s = await this.getDirectoryHandle(P(t), !1);
|
|
942
953
|
try {
|
|
943
|
-
await s.removeEntry(a, { recursive:
|
|
954
|
+
await s.removeEntry(a, { recursive: i });
|
|
944
955
|
} catch (o) {
|
|
945
956
|
if (o.name === "NotFoundError") {
|
|
946
|
-
if (!
|
|
957
|
+
if (!n)
|
|
947
958
|
throw new c(\`No such file or directory: \${t}\`, "ENOENT");
|
|
948
|
-
} else throw o.name === "InvalidModificationError" ? new c(\`Directory not empty: \${t}. Use recursive option to force removal.\`, "ENOTEMPTY") : o.name === "TypeMismatchError" && !
|
|
959
|
+
} else throw o.name === "InvalidModificationError" ? new c(\`Directory not empty: \${t}. Use recursive option to force removal.\`, "ENOTEMPTY") : o.name === "TypeMismatchError" && !i ? new c(\`Cannot remove directory without recursive option: \${t}\`, "EISDIR") : new c(\`Failed to remove path: \${t}\`, "RM_FAILED");
|
|
949
960
|
}
|
|
950
961
|
await this.notifyChange({ path: t, type: "removed", isDirectory: !1 });
|
|
951
962
|
}
|
|
@@ -972,7 +983,7 @@ class wt {
|
|
|
972
983
|
try {
|
|
973
984
|
const r = ct(t);
|
|
974
985
|
if (!await this.exists(r))
|
|
975
|
-
throw new
|
|
986
|
+
throw new T(r);
|
|
976
987
|
return r;
|
|
977
988
|
} catch (r) {
|
|
978
989
|
throw r instanceof c ? r : new c(\`Failed to resolve path: \${t}\`, "REALPATH_FAILED");
|
|
@@ -998,10 +1009,10 @@ class wt {
|
|
|
998
1009
|
await this.ensureMounted();
|
|
999
1010
|
try {
|
|
1000
1011
|
if (!await this.exists(t))
|
|
1001
|
-
throw new
|
|
1012
|
+
throw new T(t);
|
|
1002
1013
|
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 });
|
|
1003
|
-
} catch (
|
|
1004
|
-
throw
|
|
1014
|
+
} catch (i) {
|
|
1015
|
+
throw i instanceof c ? i : new c(\`Failed to rename from \${t} to \${r}\`, "RENAME_FAILED");
|
|
1005
1016
|
}
|
|
1006
1017
|
}
|
|
1007
1018
|
/**
|
|
@@ -1029,10 +1040,10 @@ class wt {
|
|
|
1029
1040
|
* await fs.copy('/source', '/dest', { recursive: true, force: false });
|
|
1030
1041
|
* \`\`\`
|
|
1031
1042
|
*/
|
|
1032
|
-
async copy(t, r,
|
|
1043
|
+
async copy(t, r, i) {
|
|
1033
1044
|
await this.ensureMounted();
|
|
1034
1045
|
try {
|
|
1035
|
-
const
|
|
1046
|
+
const n = i?.recursive ?? !1, a = i?.force ?? !0;
|
|
1036
1047
|
if (!await this.exists(t))
|
|
1037
1048
|
throw new c(\`Source does not exist: \${t}\`, "ENOENT");
|
|
1038
1049
|
if (await this.exists(r) && !a)
|
|
@@ -1041,18 +1052,18 @@ class wt {
|
|
|
1041
1052
|
const h = await this.readFile(t, "binary");
|
|
1042
1053
|
await this.writeFile(r, h);
|
|
1043
1054
|
} else {
|
|
1044
|
-
if (!
|
|
1055
|
+
if (!n)
|
|
1045
1056
|
throw new c(\`Cannot copy directory without recursive option: \${t}\`, "EISDIR");
|
|
1046
1057
|
await this.mkdir(r, { recursive: !0 });
|
|
1047
|
-
const h = await this.
|
|
1058
|
+
const h = await this.readDir(t);
|
|
1048
1059
|
for (const u of h) {
|
|
1049
1060
|
const w = \`\${t}/\${u.name}\`, f = \`\${r}/\${u.name}\`;
|
|
1050
1061
|
await this.copy(w, f, { recursive: !0, force: a });
|
|
1051
1062
|
}
|
|
1052
1063
|
}
|
|
1053
1064
|
await this.notifyChange({ path: r, type: "added", isDirectory: !1 });
|
|
1054
|
-
} catch (
|
|
1055
|
-
throw
|
|
1065
|
+
} catch (n) {
|
|
1066
|
+
throw n instanceof c ? n : new c(\`Failed to copy from \${t} to \${r}\`, "CP_FAILED");
|
|
1056
1067
|
}
|
|
1057
1068
|
}
|
|
1058
1069
|
/**
|
|
@@ -1060,8 +1071,8 @@ class wt {
|
|
|
1060
1071
|
*/
|
|
1061
1072
|
async watch(t) {
|
|
1062
1073
|
await this.ensureMounted();
|
|
1063
|
-
const r =
|
|
1064
|
-
this.watchers.set(r,
|
|
1074
|
+
const r = F(t), i = await this.buildSnapshot(r);
|
|
1075
|
+
this.watchers.set(r, i), this.watchTimer || (this.watchTimer = setInterval(() => {
|
|
1065
1076
|
this.scanWatches();
|
|
1066
1077
|
}, this.options.watchInterval));
|
|
1067
1078
|
}
|
|
@@ -1069,7 +1080,7 @@ class wt {
|
|
|
1069
1080
|
* Stop watching a previously watched path
|
|
1070
1081
|
*/
|
|
1071
1082
|
unwatch(t) {
|
|
1072
|
-
const r =
|
|
1083
|
+
const r = F(t);
|
|
1073
1084
|
this.watchers.delete(r), this.watchers.size === 0 && this.watchTimer && (clearInterval(this.watchTimer), this.watchTimer = null);
|
|
1074
1085
|
}
|
|
1075
1086
|
/**
|
|
@@ -1082,17 +1093,17 @@ class wt {
|
|
|
1082
1093
|
this.broadcastChannel && (this.broadcastChannel.close(), this.broadcastChannel = null), this.watchTimer && (clearInterval(this.watchTimer), this.watchTimer = null), this.watchers.clear();
|
|
1083
1094
|
}
|
|
1084
1095
|
async buildSnapshot(t) {
|
|
1085
|
-
const r = /* @__PURE__ */ new Map(),
|
|
1086
|
-
const a = await this.stat(
|
|
1087
|
-
if (r.set(
|
|
1088
|
-
const s = await this.
|
|
1096
|
+
const r = /* @__PURE__ */ new Map(), i = async (n) => {
|
|
1097
|
+
const a = await this.stat(n);
|
|
1098
|
+
if (r.set(n, a), a.isDirectory) {
|
|
1099
|
+
const s = await this.readDir(n);
|
|
1089
1100
|
for (const o of s) {
|
|
1090
|
-
const l = \`\${
|
|
1091
|
-
await
|
|
1101
|
+
const l = \`\${n === "/" ? "" : n}/\${o.name}\`;
|
|
1102
|
+
await i(l);
|
|
1092
1103
|
}
|
|
1093
1104
|
}
|
|
1094
1105
|
};
|
|
1095
|
-
return await
|
|
1106
|
+
return await i(t), r;
|
|
1096
1107
|
}
|
|
1097
1108
|
async scanWatches() {
|
|
1098
1109
|
if (!this.scanning) {
|
|
@@ -1100,22 +1111,22 @@ class wt {
|
|
|
1100
1111
|
try {
|
|
1101
1112
|
await Promise.all(
|
|
1102
1113
|
[...this.watchers.entries()].map(async ([t, r]) => {
|
|
1103
|
-
let
|
|
1114
|
+
let i;
|
|
1104
1115
|
try {
|
|
1105
|
-
|
|
1116
|
+
i = await this.buildSnapshot(t);
|
|
1106
1117
|
} catch {
|
|
1107
|
-
|
|
1118
|
+
i = /* @__PURE__ */ new Map();
|
|
1108
1119
|
}
|
|
1109
|
-
for (const [
|
|
1110
|
-
const s = r.get(
|
|
1111
|
-
s ? (s.mtime !== a.mtime || s.size !== a.size) && await this.notifyChange({ path:
|
|
1120
|
+
for (const [n, a] of i) {
|
|
1121
|
+
const s = r.get(n);
|
|
1122
|
+
s ? (s.mtime !== a.mtime || s.size !== a.size) && await this.notifyChange({ path: n, type: "changed", isDirectory: a.isDirectory }) : await this.notifyChange({ path: n, type: "added", isDirectory: a.isDirectory });
|
|
1112
1123
|
}
|
|
1113
|
-
for (const
|
|
1114
|
-
if (!
|
|
1115
|
-
const a = r.get(
|
|
1116
|
-
await this.notifyChange({ path:
|
|
1124
|
+
for (const n of r.keys())
|
|
1125
|
+
if (!i.has(n)) {
|
|
1126
|
+
const a = r.get(n);
|
|
1127
|
+
await this.notifyChange({ path: n, type: "removed", isDirectory: a?.isDirectory ?? !1 });
|
|
1117
1128
|
}
|
|
1118
|
-
this.watchers.set(t,
|
|
1129
|
+
this.watchers.set(t, i);
|
|
1119
1130
|
})
|
|
1120
1131
|
);
|
|
1121
1132
|
} finally {
|
|
@@ -1155,18 +1166,18 @@ class wt {
|
|
|
1155
1166
|
await this.ensureMounted();
|
|
1156
1167
|
try {
|
|
1157
1168
|
(r?.cleanBefore ?? !1) && await this.clear("/");
|
|
1158
|
-
for (const [
|
|
1159
|
-
const s =
|
|
1169
|
+
for (const [n, a] of t) {
|
|
1170
|
+
const s = F(n);
|
|
1160
1171
|
let o;
|
|
1161
1172
|
a instanceof Blob ? o = await ft(a) : o = a, await this.writeFile(s, o);
|
|
1162
1173
|
}
|
|
1163
1174
|
await this.notifyChange({ path: "/", type: "changed", isDirectory: !0 });
|
|
1164
|
-
} catch (
|
|
1165
|
-
throw
|
|
1175
|
+
} catch (i) {
|
|
1176
|
+
throw i instanceof c ? i : new c("Failed to sync file system", "SYNC_FAILED");
|
|
1166
1177
|
}
|
|
1167
1178
|
}
|
|
1168
1179
|
}
|
|
1169
|
-
typeof self < "u" && self.constructor.name === "DedicatedWorkerGlobalScope" &&
|
|
1170
|
-
//# sourceMappingURL=worker-
|
|
1180
|
+
typeof self < "u" && self.constructor.name === "DedicatedWorkerGlobalScope" && x(new wt());
|
|
1181
|
+
//# sourceMappingURL=worker-CLK22qZk.js.map
|
|
1171
1182
|
`,a=typeof self<"u"&&self.Blob&&new Blob(["URL.revokeObjectURL(import.meta.url);",i],{type:"text/javascript;charset=utf-8"});function s(e){let t;try{if(t=a&&(self.URL||self.webkitURL).createObjectURL(a),!t)throw"";const r=new Worker(t,{type:"module",name:e?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(i),{type:"module",name:e?.name})}}function c(e){const t=o.wrap(new s);return e&&t.setOptions(e),t}exports.DirectoryNotFoundError=n.DirectoryNotFoundError;exports.FileNotFoundError=n.FileNotFoundError;exports.OPFSError=n.OPFSError;exports.OPFSNotMountedError=n.OPFSNotMountedError;exports.OPFSNotSupportedError=n.OPFSNotSupportedError;exports.PathError=n.PathError;exports.PermissionError=n.PermissionError;exports.StorageError=n.StorageError;exports.TimeoutError=n.TimeoutError;exports.basename=n.basename;exports.calculateFileHash=n.calculateFileHash;exports.checkOPFSSupport=n.checkOPFSSupport;exports.convertBlobToUint8Array=n.convertBlobToUint8Array;exports.createBuffer=n.createBuffer;exports.decodeBuffer=n.decodeBuffer;exports.dirname=n.dirname;exports.encodeString=n.encodeString;exports.extname=n.extname;exports.joinPath=n.joinPath;exports.normalizePath=n.normalizePath;exports.readFileData=n.readFileData;exports.resolvePath=n.resolvePath;exports.splitPath=n.splitPath;exports.writeFileData=n.writeFileData;exports.createWorker=c;
|
|
1172
1183
|
//# sourceMappingURL=index.cjs.map
|