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