opfs-worker 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -7
- package/dist/assets/worker-DilNsKoO.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 +218 -208
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +228 -218
- package/dist/index.js.map +1 -1
- package/dist/raw.cjs +1 -1
- package/dist/raw.cjs.map +1 -1
- package/dist/raw.js +42 -32
- package/dist/raw.js.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,21 @@ 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
462
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
463
463
|
...t,
|
|
464
464
|
...r && { hash: r }
|
|
465
465
|
};
|
|
466
|
-
this.broadcastChannel.postMessage(
|
|
467
|
-
} catch (
|
|
468
|
-
console.warn("Failed to send event via BroadcastChannel:",
|
|
466
|
+
this.broadcastChannel.postMessage(i);
|
|
467
|
+
} catch (i) {
|
|
468
|
+
console.warn("Failed to send event via BroadcastChannel:", i);
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
471
|
/**
|
|
@@ -502,13 +502,13 @@ class wt {
|
|
|
502
502
|
* \`\`\`
|
|
503
503
|
*/
|
|
504
504
|
async mount(t = "/") {
|
|
505
|
-
return this.mountingPromise && await this.mountingPromise, this.mountingPromise = new Promise(async (r,
|
|
505
|
+
return this.mountingPromise && await this.mountingPromise, this.mountingPromise = new Promise(async (r, i) => {
|
|
506
506
|
this.root = null;
|
|
507
507
|
try {
|
|
508
|
-
const
|
|
509
|
-
t === "/" ? this.root =
|
|
510
|
-
} catch (
|
|
511
|
-
console.error(
|
|
508
|
+
const n = await navigator.storage.getDirectory();
|
|
509
|
+
t === "/" ? this.root = n : this.root = await this.getDirectoryHandle(t, !0, n), r(!0);
|
|
510
|
+
} catch (n) {
|
|
511
|
+
console.error(n), i(new c("Failed to initialize OPFS", "INIT_FAILED"));
|
|
512
512
|
} finally {
|
|
513
513
|
this.mountingPromise = null;
|
|
514
514
|
}
|
|
@@ -562,12 +562,12 @@ class wt {
|
|
|
562
562
|
* const docsDir2 = await fs.getDirectoryHandle(['users', 'john', 'documents'], true);
|
|
563
563
|
* \`\`\`
|
|
564
564
|
*/
|
|
565
|
-
async getDirectoryHandle(t, r = !1,
|
|
566
|
-
if (!
|
|
567
|
-
throw new
|
|
568
|
-
const
|
|
569
|
-
let a =
|
|
570
|
-
for (const s of
|
|
565
|
+
async getDirectoryHandle(t, r = !1, i = this.root) {
|
|
566
|
+
if (!i)
|
|
567
|
+
throw new b();
|
|
568
|
+
const n = Array.isArray(t) ? t : m(t);
|
|
569
|
+
let a = i;
|
|
570
|
+
for (const s of n)
|
|
571
571
|
a = await a.getDirectoryHandle(s, { create: r });
|
|
572
572
|
return a;
|
|
573
573
|
}
|
|
@@ -590,14 +590,14 @@ class wt {
|
|
|
590
590
|
* const fileHandle2 = await fs.getFileHandle(['config', 'settings.json'], true);
|
|
591
591
|
* \`\`\`
|
|
592
592
|
*/
|
|
593
|
-
async getFileHandle(t, r = !1,
|
|
594
|
-
if (!
|
|
595
|
-
throw new
|
|
596
|
-
const
|
|
597
|
-
if (
|
|
593
|
+
async getFileHandle(t, r = !1, i = this.root) {
|
|
594
|
+
if (!i)
|
|
595
|
+
throw new b();
|
|
596
|
+
const n = m(t);
|
|
597
|
+
if (n.length === 0)
|
|
598
598
|
throw new N("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
|
|
599
|
-
const a =
|
|
600
|
-
return (await this.getDirectoryHandle(
|
|
599
|
+
const a = n.pop();
|
|
600
|
+
return (await this.getDirectoryHandle(n, r, i)).getFileHandle(a, { create: r });
|
|
601
601
|
}
|
|
602
602
|
/**
|
|
603
603
|
* Get a complete index of all files and directories in the file system
|
|
@@ -619,10 +619,10 @@ class wt {
|
|
|
619
619
|
* \`\`\`
|
|
620
620
|
*/
|
|
621
621
|
async index() {
|
|
622
|
-
const t = /* @__PURE__ */ new Map(), r = async (
|
|
623
|
-
const
|
|
624
|
-
for (const a of
|
|
625
|
-
const s = \`\${
|
|
622
|
+
const t = /* @__PURE__ */ new Map(), r = async (i) => {
|
|
623
|
+
const n = await this.readDir(i);
|
|
624
|
+
for (const a of n) {
|
|
625
|
+
const s = \`\${i === "/" ? "" : i}/\${a.name}\`;
|
|
626
626
|
try {
|
|
627
627
|
const o = await this.stat(s);
|
|
628
628
|
t.set(s, o), o.isDirectory && await r(s);
|
|
@@ -643,10 +643,10 @@ class wt {
|
|
|
643
643
|
async readFile(t, r = "utf-8") {
|
|
644
644
|
await this.ensureMounted();
|
|
645
645
|
try {
|
|
646
|
-
const
|
|
647
|
-
return r === "binary" ?
|
|
648
|
-
} catch (
|
|
649
|
-
throw console.error(
|
|
646
|
+
const i = await this.getFileHandle(t, !1), n = await ht(i);
|
|
647
|
+
return r === "binary" ? n : rt(n, r);
|
|
648
|
+
} catch (i) {
|
|
649
|
+
throw console.error(i), new T(t);
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
652
|
/**
|
|
@@ -674,10 +674,10 @@ class wt {
|
|
|
674
674
|
* await fs.writeFile('/data/utf16.txt', 'Hello World', 'utf-16le');
|
|
675
675
|
* \`\`\`
|
|
676
676
|
*/
|
|
677
|
-
async writeFile(t, r,
|
|
677
|
+
async writeFile(t, r, i) {
|
|
678
678
|
await this.ensureMounted();
|
|
679
|
-
const
|
|
680
|
-
await k(
|
|
679
|
+
const n = await this.getFileHandle(t, !0);
|
|
680
|
+
await k(n, r, i, { truncate: !0 }), await this.notifyChange({ path: t, type: "changed", isDirectory: !1 });
|
|
681
681
|
}
|
|
682
682
|
/**
|
|
683
683
|
* Append data to a file
|
|
@@ -701,10 +701,10 @@ class wt {
|
|
|
701
701
|
* await fs.appendFile('/data/binary.dat', additionalData);
|
|
702
702
|
* \`\`\`
|
|
703
703
|
*/
|
|
704
|
-
async appendFile(t, r,
|
|
704
|
+
async appendFile(t, r, i) {
|
|
705
705
|
await this.ensureMounted();
|
|
706
|
-
const
|
|
707
|
-
await k(
|
|
706
|
+
const n = await this.getFileHandle(t, !0);
|
|
707
|
+
await k(n, r, i, { append: !0 }), await this.notifyChange({ path: t, type: "changed", isDirectory: !1 });
|
|
708
708
|
}
|
|
709
709
|
/**
|
|
710
710
|
* Create a directory
|
|
@@ -729,16 +729,16 @@ class wt {
|
|
|
729
729
|
*/
|
|
730
730
|
async mkdir(t, r) {
|
|
731
731
|
if (await this.ensureMounted(), !this.root)
|
|
732
|
-
throw new
|
|
733
|
-
const
|
|
732
|
+
throw new b();
|
|
733
|
+
const i = r?.recursive ?? !1, n = m(t);
|
|
734
734
|
let a = this.root;
|
|
735
|
-
for (let s = 0; s <
|
|
736
|
-
const o =
|
|
735
|
+
for (let s = 0; s < n.length; s++) {
|
|
736
|
+
const o = n[s];
|
|
737
737
|
try {
|
|
738
|
-
a = await a.getDirectoryHandle(o, { create:
|
|
738
|
+
a = await a.getDirectoryHandle(o, { create: i || s === n.length - 1 });
|
|
739
739
|
} catch (l) {
|
|
740
740
|
throw l.name === "NotFoundError" ? new c(
|
|
741
|
-
\`Parent directory does not exist: \${
|
|
741
|
+
\`Parent directory does not exist: \${I(n.slice(0, s + 1))}\`,
|
|
742
742
|
"ENOENT"
|
|
743
743
|
) : l.name === "TypeMismatchError" ? new c(\`Path segment is not a directory: \${o}\`, "ENOTDIR") : new c("Failed to create directory", "MKDIR_FAILED");
|
|
744
744
|
}
|
|
@@ -777,9 +777,9 @@ class wt {
|
|
|
777
777
|
isFile: !1,
|
|
778
778
|
isDirectory: !0
|
|
779
779
|
};
|
|
780
|
-
const r =
|
|
780
|
+
const r = O(t), i = await this.getDirectoryHandle(P(t), !1), n = this.options.hashAlgorithm !== null;
|
|
781
781
|
try {
|
|
782
|
-
const s = await (await
|
|
782
|
+
const s = await (await i.getFileHandle(r, { create: !1 })).getFile(), o = {
|
|
783
783
|
kind: "file",
|
|
784
784
|
size: s.size,
|
|
785
785
|
mtime: new Date(s.lastModified).toISOString(),
|
|
@@ -787,7 +787,7 @@ class wt {
|
|
|
787
787
|
isFile: !0,
|
|
788
788
|
isDirectory: !1
|
|
789
789
|
};
|
|
790
|
-
if (
|
|
790
|
+
if (n && this.options.hashAlgorithm)
|
|
791
791
|
try {
|
|
792
792
|
const l = await ut(s, this.options.hashAlgorithm, this.options.maxFileSize);
|
|
793
793
|
o.hash = l;
|
|
@@ -800,7 +800,7 @@ class wt {
|
|
|
800
800
|
throw new c("Failed to stat (file)", "STAT_FAILED");
|
|
801
801
|
}
|
|
802
802
|
try {
|
|
803
|
-
return await
|
|
803
|
+
return await i.getDirectoryHandle(r, { create: !1 }), {
|
|
804
804
|
kind: "directory",
|
|
805
805
|
size: 0,
|
|
806
806
|
mtime: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
@@ -812,27 +812,37 @@ class wt {
|
|
|
812
812
|
throw a.name === "NotFoundError" ? new c(\`No such file or directory: \${t}\`, "ENOENT") : new c("Failed to stat (directory)", "STAT_FAILED");
|
|
813
813
|
}
|
|
814
814
|
}
|
|
815
|
-
|
|
815
|
+
/**
|
|
816
|
+
* Read a directory's contents
|
|
817
|
+
*
|
|
818
|
+
* Lists all files and subdirectories within the specified directory.
|
|
819
|
+
*
|
|
820
|
+
* @param path - The path to the directory to read
|
|
821
|
+
* @returns Promise that resolves to an array of detailed file/directory information
|
|
822
|
+
* @throws {OPFSError} If the directory does not exist or cannot be accessed
|
|
823
|
+
*
|
|
824
|
+
* @example
|
|
825
|
+
* \`\`\`typescript
|
|
826
|
+
* // Get detailed information about files and directories
|
|
827
|
+
* const detailed = await fs.readDir('/users/john/documents');
|
|
828
|
+
* detailed.forEach(item => {
|
|
829
|
+
* console.log(\`\${item.name} - \${item.isFile ? 'file' : 'directory'}\`);
|
|
830
|
+
* });
|
|
831
|
+
* \`\`\`
|
|
832
|
+
*/
|
|
833
|
+
async readDir(t) {
|
|
816
834
|
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;
|
|
835
|
+
const r = await this.getDirectoryHandle(t, !1), i = [];
|
|
836
|
+
for await (const [n, a] of r.entries()) {
|
|
837
|
+
const s = a.kind === "file";
|
|
838
|
+
i.push({
|
|
839
|
+
name: n,
|
|
840
|
+
kind: a.kind,
|
|
841
|
+
isFile: s,
|
|
842
|
+
isDirectory: !s
|
|
843
|
+
});
|
|
835
844
|
}
|
|
845
|
+
return i;
|
|
836
846
|
}
|
|
837
847
|
/**
|
|
838
848
|
* Check if a file or directory exists
|
|
@@ -851,26 +861,26 @@ class wt {
|
|
|
851
861
|
async exists(t) {
|
|
852
862
|
if (await this.ensureMounted(), t === "/")
|
|
853
863
|
return !0;
|
|
854
|
-
const r =
|
|
855
|
-
let
|
|
864
|
+
const r = O(t);
|
|
865
|
+
let i = null;
|
|
856
866
|
try {
|
|
857
|
-
|
|
858
|
-
} catch (
|
|
859
|
-
throw (
|
|
867
|
+
i = await this.getDirectoryHandle(P(t), !1);
|
|
868
|
+
} catch (n) {
|
|
869
|
+
throw (n.name === "NotFoundError" || n.name === "TypeMismatchError") && (i = null), n;
|
|
860
870
|
}
|
|
861
|
-
if (!
|
|
871
|
+
if (!i || !r)
|
|
862
872
|
return !1;
|
|
863
873
|
try {
|
|
864
|
-
return await
|
|
865
|
-
} catch (
|
|
866
|
-
if (
|
|
867
|
-
throw
|
|
874
|
+
return await i.getFileHandle(r, { create: !1 }), !0;
|
|
875
|
+
} catch (n) {
|
|
876
|
+
if (n.name !== "NotFoundError" && n.name !== "TypeMismatchError")
|
|
877
|
+
throw n;
|
|
868
878
|
}
|
|
869
879
|
try {
|
|
870
|
-
return await
|
|
871
|
-
} catch (
|
|
872
|
-
if (
|
|
873
|
-
throw
|
|
880
|
+
return await i.getDirectoryHandle(r, { create: !1 }), !0;
|
|
881
|
+
} catch (n) {
|
|
882
|
+
if (n.name !== "NotFoundError" && n.name !== "TypeMismatchError")
|
|
883
|
+
throw n;
|
|
874
884
|
}
|
|
875
885
|
return !1;
|
|
876
886
|
}
|
|
@@ -896,10 +906,10 @@ class wt {
|
|
|
896
906
|
async clear(t = "/") {
|
|
897
907
|
await this.ensureMounted();
|
|
898
908
|
try {
|
|
899
|
-
const r = await this.
|
|
900
|
-
for (const
|
|
901
|
-
const
|
|
902
|
-
await this.remove(
|
|
909
|
+
const r = await this.readDir(t);
|
|
910
|
+
for (const i of r) {
|
|
911
|
+
const n = \`\${t === "/" ? "" : t}/\${i.name}\`;
|
|
912
|
+
await this.remove(n, { recursive: !0 });
|
|
903
913
|
}
|
|
904
914
|
await this.notifyChange({ path: t, type: "changed", isDirectory: !0 });
|
|
905
915
|
} catch (r) {
|
|
@@ -932,20 +942,20 @@ class wt {
|
|
|
932
942
|
*/
|
|
933
943
|
async remove(t, r) {
|
|
934
944
|
await this.ensureMounted();
|
|
935
|
-
const
|
|
945
|
+
const i = r?.recursive ?? !1, n = r?.force ?? !1;
|
|
936
946
|
if (t === "/")
|
|
937
947
|
throw new c("Cannot remove root directory", "EROOT");
|
|
938
|
-
const a =
|
|
948
|
+
const a = O(t);
|
|
939
949
|
if (!a)
|
|
940
950
|
throw new N("Invalid path", t);
|
|
941
|
-
const s = await this.getDirectoryHandle(
|
|
951
|
+
const s = await this.getDirectoryHandle(P(t), !1);
|
|
942
952
|
try {
|
|
943
|
-
await s.removeEntry(a, { recursive:
|
|
953
|
+
await s.removeEntry(a, { recursive: i });
|
|
944
954
|
} catch (o) {
|
|
945
955
|
if (o.name === "NotFoundError") {
|
|
946
|
-
if (!
|
|
956
|
+
if (!n)
|
|
947
957
|
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" && !
|
|
958
|
+
} 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
959
|
}
|
|
950
960
|
await this.notifyChange({ path: t, type: "removed", isDirectory: !1 });
|
|
951
961
|
}
|
|
@@ -972,7 +982,7 @@ class wt {
|
|
|
972
982
|
try {
|
|
973
983
|
const r = ct(t);
|
|
974
984
|
if (!await this.exists(r))
|
|
975
|
-
throw new
|
|
985
|
+
throw new T(r);
|
|
976
986
|
return r;
|
|
977
987
|
} catch (r) {
|
|
978
988
|
throw r instanceof c ? r : new c(\`Failed to resolve path: \${t}\`, "REALPATH_FAILED");
|
|
@@ -998,10 +1008,10 @@ class wt {
|
|
|
998
1008
|
await this.ensureMounted();
|
|
999
1009
|
try {
|
|
1000
1010
|
if (!await this.exists(t))
|
|
1001
|
-
throw new
|
|
1011
|
+
throw new T(t);
|
|
1002
1012
|
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
|
|
1013
|
+
} catch (i) {
|
|
1014
|
+
throw i instanceof c ? i : new c(\`Failed to rename from \${t} to \${r}\`, "RENAME_FAILED");
|
|
1005
1015
|
}
|
|
1006
1016
|
}
|
|
1007
1017
|
/**
|
|
@@ -1029,10 +1039,10 @@ class wt {
|
|
|
1029
1039
|
* await fs.copy('/source', '/dest', { recursive: true, force: false });
|
|
1030
1040
|
* \`\`\`
|
|
1031
1041
|
*/
|
|
1032
|
-
async copy(t, r,
|
|
1042
|
+
async copy(t, r, i) {
|
|
1033
1043
|
await this.ensureMounted();
|
|
1034
1044
|
try {
|
|
1035
|
-
const
|
|
1045
|
+
const n = i?.recursive ?? !1, a = i?.force ?? !0;
|
|
1036
1046
|
if (!await this.exists(t))
|
|
1037
1047
|
throw new c(\`Source does not exist: \${t}\`, "ENOENT");
|
|
1038
1048
|
if (await this.exists(r) && !a)
|
|
@@ -1041,18 +1051,18 @@ class wt {
|
|
|
1041
1051
|
const h = await this.readFile(t, "binary");
|
|
1042
1052
|
await this.writeFile(r, h);
|
|
1043
1053
|
} else {
|
|
1044
|
-
if (!
|
|
1054
|
+
if (!n)
|
|
1045
1055
|
throw new c(\`Cannot copy directory without recursive option: \${t}\`, "EISDIR");
|
|
1046
1056
|
await this.mkdir(r, { recursive: !0 });
|
|
1047
|
-
const h = await this.
|
|
1057
|
+
const h = await this.readDir(t);
|
|
1048
1058
|
for (const u of h) {
|
|
1049
1059
|
const w = \`\${t}/\${u.name}\`, f = \`\${r}/\${u.name}\`;
|
|
1050
1060
|
await this.copy(w, f, { recursive: !0, force: a });
|
|
1051
1061
|
}
|
|
1052
1062
|
}
|
|
1053
1063
|
await this.notifyChange({ path: r, type: "added", isDirectory: !1 });
|
|
1054
|
-
} catch (
|
|
1055
|
-
throw
|
|
1064
|
+
} catch (n) {
|
|
1065
|
+
throw n instanceof c ? n : new c(\`Failed to copy from \${t} to \${r}\`, "CP_FAILED");
|
|
1056
1066
|
}
|
|
1057
1067
|
}
|
|
1058
1068
|
/**
|
|
@@ -1060,8 +1070,8 @@ class wt {
|
|
|
1060
1070
|
*/
|
|
1061
1071
|
async watch(t) {
|
|
1062
1072
|
await this.ensureMounted();
|
|
1063
|
-
const r =
|
|
1064
|
-
this.watchers.set(r,
|
|
1073
|
+
const r = F(t), i = await this.buildSnapshot(r);
|
|
1074
|
+
this.watchers.set(r, i), this.watchTimer || (this.watchTimer = setInterval(() => {
|
|
1065
1075
|
this.scanWatches();
|
|
1066
1076
|
}, this.options.watchInterval));
|
|
1067
1077
|
}
|
|
@@ -1069,7 +1079,7 @@ class wt {
|
|
|
1069
1079
|
* Stop watching a previously watched path
|
|
1070
1080
|
*/
|
|
1071
1081
|
unwatch(t) {
|
|
1072
|
-
const r =
|
|
1082
|
+
const r = F(t);
|
|
1073
1083
|
this.watchers.delete(r), this.watchers.size === 0 && this.watchTimer && (clearInterval(this.watchTimer), this.watchTimer = null);
|
|
1074
1084
|
}
|
|
1075
1085
|
/**
|
|
@@ -1082,17 +1092,17 @@ class wt {
|
|
|
1082
1092
|
this.broadcastChannel && (this.broadcastChannel.close(), this.broadcastChannel = null), this.watchTimer && (clearInterval(this.watchTimer), this.watchTimer = null), this.watchers.clear();
|
|
1083
1093
|
}
|
|
1084
1094
|
async buildSnapshot(t) {
|
|
1085
|
-
const r = /* @__PURE__ */ new Map(),
|
|
1086
|
-
const a = await this.stat(
|
|
1087
|
-
if (r.set(
|
|
1088
|
-
const s = await this.
|
|
1095
|
+
const r = /* @__PURE__ */ new Map(), i = async (n) => {
|
|
1096
|
+
const a = await this.stat(n);
|
|
1097
|
+
if (r.set(n, a), a.isDirectory) {
|
|
1098
|
+
const s = await this.readDir(n);
|
|
1089
1099
|
for (const o of s) {
|
|
1090
|
-
const l = \`\${
|
|
1091
|
-
await
|
|
1100
|
+
const l = \`\${n === "/" ? "" : n}/\${o.name}\`;
|
|
1101
|
+
await i(l);
|
|
1092
1102
|
}
|
|
1093
1103
|
}
|
|
1094
1104
|
};
|
|
1095
|
-
return await
|
|
1105
|
+
return await i(t), r;
|
|
1096
1106
|
}
|
|
1097
1107
|
async scanWatches() {
|
|
1098
1108
|
if (!this.scanning) {
|
|
@@ -1100,22 +1110,22 @@ class wt {
|
|
|
1100
1110
|
try {
|
|
1101
1111
|
await Promise.all(
|
|
1102
1112
|
[...this.watchers.entries()].map(async ([t, r]) => {
|
|
1103
|
-
let
|
|
1113
|
+
let i;
|
|
1104
1114
|
try {
|
|
1105
|
-
|
|
1115
|
+
i = await this.buildSnapshot(t);
|
|
1106
1116
|
} catch {
|
|
1107
|
-
|
|
1117
|
+
i = /* @__PURE__ */ new Map();
|
|
1108
1118
|
}
|
|
1109
|
-
for (const [
|
|
1110
|
-
const s = r.get(
|
|
1111
|
-
s ? (s.mtime !== a.mtime || s.size !== a.size) && await this.notifyChange({ path:
|
|
1119
|
+
for (const [n, a] of i) {
|
|
1120
|
+
const s = r.get(n);
|
|
1121
|
+
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
1122
|
}
|
|
1113
|
-
for (const
|
|
1114
|
-
if (!
|
|
1115
|
-
const a = r.get(
|
|
1116
|
-
await this.notifyChange({ path:
|
|
1123
|
+
for (const n of r.keys())
|
|
1124
|
+
if (!i.has(n)) {
|
|
1125
|
+
const a = r.get(n);
|
|
1126
|
+
await this.notifyChange({ path: n, type: "removed", isDirectory: a?.isDirectory ?? !1 });
|
|
1117
1127
|
}
|
|
1118
|
-
this.watchers.set(t,
|
|
1128
|
+
this.watchers.set(t, i);
|
|
1119
1129
|
})
|
|
1120
1130
|
);
|
|
1121
1131
|
} finally {
|
|
@@ -1155,18 +1165,18 @@ class wt {
|
|
|
1155
1165
|
await this.ensureMounted();
|
|
1156
1166
|
try {
|
|
1157
1167
|
(r?.cleanBefore ?? !1) && await this.clear("/");
|
|
1158
|
-
for (const [
|
|
1159
|
-
const s =
|
|
1168
|
+
for (const [n, a] of t) {
|
|
1169
|
+
const s = F(n);
|
|
1160
1170
|
let o;
|
|
1161
1171
|
a instanceof Blob ? o = await ft(a) : o = a, await this.writeFile(s, o);
|
|
1162
1172
|
}
|
|
1163
1173
|
await this.notifyChange({ path: "/", type: "changed", isDirectory: !0 });
|
|
1164
|
-
} catch (
|
|
1165
|
-
throw
|
|
1174
|
+
} catch (i) {
|
|
1175
|
+
throw i instanceof c ? i : new c("Failed to sync file system", "SYNC_FAILED");
|
|
1166
1176
|
}
|
|
1167
1177
|
}
|
|
1168
1178
|
}
|
|
1169
|
-
typeof self < "u" && self.constructor.name === "DedicatedWorkerGlobalScope" &&
|
|
1170
|
-
//# sourceMappingURL=worker-
|
|
1179
|
+
typeof self < "u" && self.constructor.name === "DedicatedWorkerGlobalScope" && x(new wt());
|
|
1180
|
+
//# sourceMappingURL=worker-DilNsKoO.js.map
|
|
1171
1181
|
`,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
1182
|
//# sourceMappingURL=index.cjs.map
|