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.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 T, g as C, 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,21 @@ 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
464
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
465
465
|
...t,
|
|
466
466
|
...r && { hash: r }
|
|
467
467
|
};
|
|
468
|
-
this.broadcastChannel.postMessage(
|
|
469
|
-
} catch (
|
|
470
|
-
console.warn("Failed to send event via BroadcastChannel:",
|
|
468
|
+
this.broadcastChannel.postMessage(i);
|
|
469
|
+
} catch (i) {
|
|
470
|
+
console.warn("Failed to send event via BroadcastChannel:", i);
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
473
|
/**
|
|
@@ -504,13 +504,13 @@ class wt {
|
|
|
504
504
|
* \`\`\`
|
|
505
505
|
*/
|
|
506
506
|
async mount(t = "/") {
|
|
507
|
-
return this.mountingPromise && await this.mountingPromise, this.mountingPromise = new Promise(async (r,
|
|
507
|
+
return this.mountingPromise && await this.mountingPromise, this.mountingPromise = new Promise(async (r, i) => {
|
|
508
508
|
this.root = null;
|
|
509
509
|
try {
|
|
510
|
-
const
|
|
511
|
-
t === "/" ? this.root =
|
|
512
|
-
} catch (
|
|
513
|
-
console.error(
|
|
510
|
+
const n = await navigator.storage.getDirectory();
|
|
511
|
+
t === "/" ? this.root = n : this.root = await this.getDirectoryHandle(t, !0, n), r(!0);
|
|
512
|
+
} catch (n) {
|
|
513
|
+
console.error(n), i(new c("Failed to initialize OPFS", "INIT_FAILED"));
|
|
514
514
|
} finally {
|
|
515
515
|
this.mountingPromise = null;
|
|
516
516
|
}
|
|
@@ -564,12 +564,12 @@ class wt {
|
|
|
564
564
|
* const docsDir2 = await fs.getDirectoryHandle(['users', 'john', 'documents'], true);
|
|
565
565
|
* \`\`\`
|
|
566
566
|
*/
|
|
567
|
-
async getDirectoryHandle(t, r = !1,
|
|
568
|
-
if (!
|
|
569
|
-
throw new
|
|
570
|
-
const
|
|
571
|
-
let a =
|
|
572
|
-
for (const s of
|
|
567
|
+
async getDirectoryHandle(t, r = !1, i = this.root) {
|
|
568
|
+
if (!i)
|
|
569
|
+
throw new b();
|
|
570
|
+
const n = Array.isArray(t) ? t : m(t);
|
|
571
|
+
let a = i;
|
|
572
|
+
for (const s of n)
|
|
573
573
|
a = await a.getDirectoryHandle(s, { create: r });
|
|
574
574
|
return a;
|
|
575
575
|
}
|
|
@@ -592,14 +592,14 @@ class wt {
|
|
|
592
592
|
* const fileHandle2 = await fs.getFileHandle(['config', 'settings.json'], true);
|
|
593
593
|
* \`\`\`
|
|
594
594
|
*/
|
|
595
|
-
async getFileHandle(t, r = !1,
|
|
596
|
-
if (!
|
|
597
|
-
throw new
|
|
598
|
-
const
|
|
599
|
-
if (
|
|
595
|
+
async getFileHandle(t, r = !1, i = this.root) {
|
|
596
|
+
if (!i)
|
|
597
|
+
throw new b();
|
|
598
|
+
const n = m(t);
|
|
599
|
+
if (n.length === 0)
|
|
600
600
|
throw new N("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
|
|
601
|
-
const a =
|
|
602
|
-
return (await this.getDirectoryHandle(
|
|
601
|
+
const a = n.pop();
|
|
602
|
+
return (await this.getDirectoryHandle(n, r, i)).getFileHandle(a, { create: r });
|
|
603
603
|
}
|
|
604
604
|
/**
|
|
605
605
|
* Get a complete index of all files and directories in the file system
|
|
@@ -621,10 +621,10 @@ class wt {
|
|
|
621
621
|
* \`\`\`
|
|
622
622
|
*/
|
|
623
623
|
async index() {
|
|
624
|
-
const t = /* @__PURE__ */ new Map(), r = async (
|
|
625
|
-
const
|
|
626
|
-
for (const a of
|
|
627
|
-
const s = \`\${
|
|
624
|
+
const t = /* @__PURE__ */ new Map(), r = async (i) => {
|
|
625
|
+
const n = await this.readDir(i);
|
|
626
|
+
for (const a of n) {
|
|
627
|
+
const s = \`\${i === "/" ? "" : i}/\${a.name}\`;
|
|
628
628
|
try {
|
|
629
629
|
const o = await this.stat(s);
|
|
630
630
|
t.set(s, o), o.isDirectory && await r(s);
|
|
@@ -645,10 +645,10 @@ class wt {
|
|
|
645
645
|
async readFile(t, r = "utf-8") {
|
|
646
646
|
await this.ensureMounted();
|
|
647
647
|
try {
|
|
648
|
-
const
|
|
649
|
-
return r === "binary" ?
|
|
650
|
-
} catch (
|
|
651
|
-
throw console.error(
|
|
648
|
+
const i = await this.getFileHandle(t, !1), n = await ht(i);
|
|
649
|
+
return r === "binary" ? n : rt(n, r);
|
|
650
|
+
} catch (i) {
|
|
651
|
+
throw console.error(i), new T(t);
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
654
|
/**
|
|
@@ -676,10 +676,10 @@ class wt {
|
|
|
676
676
|
* await fs.writeFile('/data/utf16.txt', 'Hello World', 'utf-16le');
|
|
677
677
|
* \`\`\`
|
|
678
678
|
*/
|
|
679
|
-
async writeFile(t, r,
|
|
679
|
+
async writeFile(t, r, i) {
|
|
680
680
|
await this.ensureMounted();
|
|
681
|
-
const
|
|
682
|
-
await k(
|
|
681
|
+
const n = await this.getFileHandle(t, !0);
|
|
682
|
+
await k(n, r, i, { truncate: !0 }), await this.notifyChange({ path: t, type: "changed", isDirectory: !1 });
|
|
683
683
|
}
|
|
684
684
|
/**
|
|
685
685
|
* Append data to a file
|
|
@@ -703,10 +703,10 @@ class wt {
|
|
|
703
703
|
* await fs.appendFile('/data/binary.dat', additionalData);
|
|
704
704
|
* \`\`\`
|
|
705
705
|
*/
|
|
706
|
-
async appendFile(t, r,
|
|
706
|
+
async appendFile(t, r, i) {
|
|
707
707
|
await this.ensureMounted();
|
|
708
|
-
const
|
|
709
|
-
await k(
|
|
708
|
+
const n = await this.getFileHandle(t, !0);
|
|
709
|
+
await k(n, r, i, { append: !0 }), await this.notifyChange({ path: t, type: "changed", isDirectory: !1 });
|
|
710
710
|
}
|
|
711
711
|
/**
|
|
712
712
|
* Create a directory
|
|
@@ -731,16 +731,16 @@ class wt {
|
|
|
731
731
|
*/
|
|
732
732
|
async mkdir(t, r) {
|
|
733
733
|
if (await this.ensureMounted(), !this.root)
|
|
734
|
-
throw new
|
|
735
|
-
const
|
|
734
|
+
throw new b();
|
|
735
|
+
const i = r?.recursive ?? !1, n = m(t);
|
|
736
736
|
let a = this.root;
|
|
737
|
-
for (let s = 0; s <
|
|
738
|
-
const o =
|
|
737
|
+
for (let s = 0; s < n.length; s++) {
|
|
738
|
+
const o = n[s];
|
|
739
739
|
try {
|
|
740
|
-
a = await a.getDirectoryHandle(o, { create:
|
|
740
|
+
a = await a.getDirectoryHandle(o, { create: i || s === n.length - 1 });
|
|
741
741
|
} catch (l) {
|
|
742
742
|
throw l.name === "NotFoundError" ? new c(
|
|
743
|
-
\`Parent directory does not exist: \${
|
|
743
|
+
\`Parent directory does not exist: \${I(n.slice(0, s + 1))}\`,
|
|
744
744
|
"ENOENT"
|
|
745
745
|
) : l.name === "TypeMismatchError" ? new c(\`Path segment is not a directory: \${o}\`, "ENOTDIR") : new c("Failed to create directory", "MKDIR_FAILED");
|
|
746
746
|
}
|
|
@@ -779,9 +779,9 @@ class wt {
|
|
|
779
779
|
isFile: !1,
|
|
780
780
|
isDirectory: !0
|
|
781
781
|
};
|
|
782
|
-
const r =
|
|
782
|
+
const r = O(t), i = await this.getDirectoryHandle(P(t), !1), n = this.options.hashAlgorithm !== null;
|
|
783
783
|
try {
|
|
784
|
-
const s = await (await
|
|
784
|
+
const s = await (await i.getFileHandle(r, { create: !1 })).getFile(), o = {
|
|
785
785
|
kind: "file",
|
|
786
786
|
size: s.size,
|
|
787
787
|
mtime: new Date(s.lastModified).toISOString(),
|
|
@@ -789,7 +789,7 @@ class wt {
|
|
|
789
789
|
isFile: !0,
|
|
790
790
|
isDirectory: !1
|
|
791
791
|
};
|
|
792
|
-
if (
|
|
792
|
+
if (n && this.options.hashAlgorithm)
|
|
793
793
|
try {
|
|
794
794
|
const l = await ut(s, this.options.hashAlgorithm, this.options.maxFileSize);
|
|
795
795
|
o.hash = l;
|
|
@@ -802,7 +802,7 @@ class wt {
|
|
|
802
802
|
throw new c("Failed to stat (file)", "STAT_FAILED");
|
|
803
803
|
}
|
|
804
804
|
try {
|
|
805
|
-
return await
|
|
805
|
+
return await i.getDirectoryHandle(r, { create: !1 }), {
|
|
806
806
|
kind: "directory",
|
|
807
807
|
size: 0,
|
|
808
808
|
mtime: (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
@@ -814,27 +814,37 @@ class wt {
|
|
|
814
814
|
throw a.name === "NotFoundError" ? new c(\`No such file or directory: \${t}\`, "ENOENT") : new c("Failed to stat (directory)", "STAT_FAILED");
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
|
-
|
|
817
|
+
/**
|
|
818
|
+
* Read a directory's contents
|
|
819
|
+
*
|
|
820
|
+
* Lists all files and subdirectories within the specified directory.
|
|
821
|
+
*
|
|
822
|
+
* @param path - The path to the directory to read
|
|
823
|
+
* @returns Promise that resolves to an array of detailed file/directory information
|
|
824
|
+
* @throws {OPFSError} If the directory does not exist or cannot be accessed
|
|
825
|
+
*
|
|
826
|
+
* @example
|
|
827
|
+
* \`\`\`typescript
|
|
828
|
+
* // Get detailed information about files and directories
|
|
829
|
+
* const detailed = await fs.readDir('/users/john/documents');
|
|
830
|
+
* detailed.forEach(item => {
|
|
831
|
+
* console.log(\`\${item.name} - \${item.isFile ? 'file' : 'directory'}\`);
|
|
832
|
+
* });
|
|
833
|
+
* \`\`\`
|
|
834
|
+
*/
|
|
835
|
+
async readDir(t) {
|
|
818
836
|
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;
|
|
837
|
+
const r = await this.getDirectoryHandle(t, !1), i = [];
|
|
838
|
+
for await (const [n, a] of r.entries()) {
|
|
839
|
+
const s = a.kind === "file";
|
|
840
|
+
i.push({
|
|
841
|
+
name: n,
|
|
842
|
+
kind: a.kind,
|
|
843
|
+
isFile: s,
|
|
844
|
+
isDirectory: !s
|
|
845
|
+
});
|
|
837
846
|
}
|
|
847
|
+
return i;
|
|
838
848
|
}
|
|
839
849
|
/**
|
|
840
850
|
* Check if a file or directory exists
|
|
@@ -853,26 +863,26 @@ class wt {
|
|
|
853
863
|
async exists(t) {
|
|
854
864
|
if (await this.ensureMounted(), t === "/")
|
|
855
865
|
return !0;
|
|
856
|
-
const r =
|
|
857
|
-
let
|
|
866
|
+
const r = O(t);
|
|
867
|
+
let i = null;
|
|
858
868
|
try {
|
|
859
|
-
|
|
860
|
-
} catch (
|
|
861
|
-
throw (
|
|
869
|
+
i = await this.getDirectoryHandle(P(t), !1);
|
|
870
|
+
} catch (n) {
|
|
871
|
+
throw (n.name === "NotFoundError" || n.name === "TypeMismatchError") && (i = null), n;
|
|
862
872
|
}
|
|
863
|
-
if (!
|
|
873
|
+
if (!i || !r)
|
|
864
874
|
return !1;
|
|
865
875
|
try {
|
|
866
|
-
return await
|
|
867
|
-
} catch (
|
|
868
|
-
if (
|
|
869
|
-
throw
|
|
876
|
+
return await i.getFileHandle(r, { create: !1 }), !0;
|
|
877
|
+
} catch (n) {
|
|
878
|
+
if (n.name !== "NotFoundError" && n.name !== "TypeMismatchError")
|
|
879
|
+
throw n;
|
|
870
880
|
}
|
|
871
881
|
try {
|
|
872
|
-
return await
|
|
873
|
-
} catch (
|
|
874
|
-
if (
|
|
875
|
-
throw
|
|
882
|
+
return await i.getDirectoryHandle(r, { create: !1 }), !0;
|
|
883
|
+
} catch (n) {
|
|
884
|
+
if (n.name !== "NotFoundError" && n.name !== "TypeMismatchError")
|
|
885
|
+
throw n;
|
|
876
886
|
}
|
|
877
887
|
return !1;
|
|
878
888
|
}
|
|
@@ -898,10 +908,10 @@ class wt {
|
|
|
898
908
|
async clear(t = "/") {
|
|
899
909
|
await this.ensureMounted();
|
|
900
910
|
try {
|
|
901
|
-
const r = await this.
|
|
902
|
-
for (const
|
|
903
|
-
const
|
|
904
|
-
await this.remove(
|
|
911
|
+
const r = await this.readDir(t);
|
|
912
|
+
for (const i of r) {
|
|
913
|
+
const n = \`\${t === "/" ? "" : t}/\${i.name}\`;
|
|
914
|
+
await this.remove(n, { recursive: !0 });
|
|
905
915
|
}
|
|
906
916
|
await this.notifyChange({ path: t, type: "changed", isDirectory: !0 });
|
|
907
917
|
} catch (r) {
|
|
@@ -934,20 +944,20 @@ class wt {
|
|
|
934
944
|
*/
|
|
935
945
|
async remove(t, r) {
|
|
936
946
|
await this.ensureMounted();
|
|
937
|
-
const
|
|
947
|
+
const i = r?.recursive ?? !1, n = r?.force ?? !1;
|
|
938
948
|
if (t === "/")
|
|
939
949
|
throw new c("Cannot remove root directory", "EROOT");
|
|
940
|
-
const a =
|
|
950
|
+
const a = O(t);
|
|
941
951
|
if (!a)
|
|
942
952
|
throw new N("Invalid path", t);
|
|
943
|
-
const s = await this.getDirectoryHandle(
|
|
953
|
+
const s = await this.getDirectoryHandle(P(t), !1);
|
|
944
954
|
try {
|
|
945
|
-
await s.removeEntry(a, { recursive:
|
|
955
|
+
await s.removeEntry(a, { recursive: i });
|
|
946
956
|
} catch (o) {
|
|
947
957
|
if (o.name === "NotFoundError") {
|
|
948
|
-
if (!
|
|
958
|
+
if (!n)
|
|
949
959
|
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" && !
|
|
960
|
+
} 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
961
|
}
|
|
952
962
|
await this.notifyChange({ path: t, type: "removed", isDirectory: !1 });
|
|
953
963
|
}
|
|
@@ -974,7 +984,7 @@ class wt {
|
|
|
974
984
|
try {
|
|
975
985
|
const r = ct(t);
|
|
976
986
|
if (!await this.exists(r))
|
|
977
|
-
throw new
|
|
987
|
+
throw new T(r);
|
|
978
988
|
return r;
|
|
979
989
|
} catch (r) {
|
|
980
990
|
throw r instanceof c ? r : new c(\`Failed to resolve path: \${t}\`, "REALPATH_FAILED");
|
|
@@ -1000,10 +1010,10 @@ class wt {
|
|
|
1000
1010
|
await this.ensureMounted();
|
|
1001
1011
|
try {
|
|
1002
1012
|
if (!await this.exists(t))
|
|
1003
|
-
throw new
|
|
1013
|
+
throw new T(t);
|
|
1004
1014
|
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
|
|
1015
|
+
} catch (i) {
|
|
1016
|
+
throw i instanceof c ? i : new c(\`Failed to rename from \${t} to \${r}\`, "RENAME_FAILED");
|
|
1007
1017
|
}
|
|
1008
1018
|
}
|
|
1009
1019
|
/**
|
|
@@ -1031,10 +1041,10 @@ class wt {
|
|
|
1031
1041
|
* await fs.copy('/source', '/dest', { recursive: true, force: false });
|
|
1032
1042
|
* \`\`\`
|
|
1033
1043
|
*/
|
|
1034
|
-
async copy(t, r,
|
|
1044
|
+
async copy(t, r, i) {
|
|
1035
1045
|
await this.ensureMounted();
|
|
1036
1046
|
try {
|
|
1037
|
-
const
|
|
1047
|
+
const n = i?.recursive ?? !1, a = i?.force ?? !0;
|
|
1038
1048
|
if (!await this.exists(t))
|
|
1039
1049
|
throw new c(\`Source does not exist: \${t}\`, "ENOENT");
|
|
1040
1050
|
if (await this.exists(r) && !a)
|
|
@@ -1043,18 +1053,18 @@ class wt {
|
|
|
1043
1053
|
const h = await this.readFile(t, "binary");
|
|
1044
1054
|
await this.writeFile(r, h);
|
|
1045
1055
|
} else {
|
|
1046
|
-
if (!
|
|
1056
|
+
if (!n)
|
|
1047
1057
|
throw new c(\`Cannot copy directory without recursive option: \${t}\`, "EISDIR");
|
|
1048
1058
|
await this.mkdir(r, { recursive: !0 });
|
|
1049
|
-
const h = await this.
|
|
1059
|
+
const h = await this.readDir(t);
|
|
1050
1060
|
for (const u of h) {
|
|
1051
1061
|
const w = \`\${t}/\${u.name}\`, f = \`\${r}/\${u.name}\`;
|
|
1052
1062
|
await this.copy(w, f, { recursive: !0, force: a });
|
|
1053
1063
|
}
|
|
1054
1064
|
}
|
|
1055
1065
|
await this.notifyChange({ path: r, type: "added", isDirectory: !1 });
|
|
1056
|
-
} catch (
|
|
1057
|
-
throw
|
|
1066
|
+
} catch (n) {
|
|
1067
|
+
throw n instanceof c ? n : new c(\`Failed to copy from \${t} to \${r}\`, "CP_FAILED");
|
|
1058
1068
|
}
|
|
1059
1069
|
}
|
|
1060
1070
|
/**
|
|
@@ -1062,8 +1072,8 @@ class wt {
|
|
|
1062
1072
|
*/
|
|
1063
1073
|
async watch(t) {
|
|
1064
1074
|
await this.ensureMounted();
|
|
1065
|
-
const r =
|
|
1066
|
-
this.watchers.set(r,
|
|
1075
|
+
const r = F(t), i = await this.buildSnapshot(r);
|
|
1076
|
+
this.watchers.set(r, i), this.watchTimer || (this.watchTimer = setInterval(() => {
|
|
1067
1077
|
this.scanWatches();
|
|
1068
1078
|
}, this.options.watchInterval));
|
|
1069
1079
|
}
|
|
@@ -1071,7 +1081,7 @@ class wt {
|
|
|
1071
1081
|
* Stop watching a previously watched path
|
|
1072
1082
|
*/
|
|
1073
1083
|
unwatch(t) {
|
|
1074
|
-
const r =
|
|
1084
|
+
const r = F(t);
|
|
1075
1085
|
this.watchers.delete(r), this.watchers.size === 0 && this.watchTimer && (clearInterval(this.watchTimer), this.watchTimer = null);
|
|
1076
1086
|
}
|
|
1077
1087
|
/**
|
|
@@ -1084,17 +1094,17 @@ class wt {
|
|
|
1084
1094
|
this.broadcastChannel && (this.broadcastChannel.close(), this.broadcastChannel = null), this.watchTimer && (clearInterval(this.watchTimer), this.watchTimer = null), this.watchers.clear();
|
|
1085
1095
|
}
|
|
1086
1096
|
async buildSnapshot(t) {
|
|
1087
|
-
const r = /* @__PURE__ */ new Map(),
|
|
1088
|
-
const a = await this.stat(
|
|
1089
|
-
if (r.set(
|
|
1090
|
-
const s = await this.
|
|
1097
|
+
const r = /* @__PURE__ */ new Map(), i = async (n) => {
|
|
1098
|
+
const a = await this.stat(n);
|
|
1099
|
+
if (r.set(n, a), a.isDirectory) {
|
|
1100
|
+
const s = await this.readDir(n);
|
|
1091
1101
|
for (const o of s) {
|
|
1092
|
-
const l = \`\${
|
|
1093
|
-
await
|
|
1102
|
+
const l = \`\${n === "/" ? "" : n}/\${o.name}\`;
|
|
1103
|
+
await i(l);
|
|
1094
1104
|
}
|
|
1095
1105
|
}
|
|
1096
1106
|
};
|
|
1097
|
-
return await
|
|
1107
|
+
return await i(t), r;
|
|
1098
1108
|
}
|
|
1099
1109
|
async scanWatches() {
|
|
1100
1110
|
if (!this.scanning) {
|
|
@@ -1102,22 +1112,22 @@ class wt {
|
|
|
1102
1112
|
try {
|
|
1103
1113
|
await Promise.all(
|
|
1104
1114
|
[...this.watchers.entries()].map(async ([t, r]) => {
|
|
1105
|
-
let
|
|
1115
|
+
let i;
|
|
1106
1116
|
try {
|
|
1107
|
-
|
|
1117
|
+
i = await this.buildSnapshot(t);
|
|
1108
1118
|
} catch {
|
|
1109
|
-
|
|
1119
|
+
i = /* @__PURE__ */ new Map();
|
|
1110
1120
|
}
|
|
1111
|
-
for (const [
|
|
1112
|
-
const s = r.get(
|
|
1113
|
-
s ? (s.mtime !== a.mtime || s.size !== a.size) && await this.notifyChange({ path:
|
|
1121
|
+
for (const [n, a] of i) {
|
|
1122
|
+
const s = r.get(n);
|
|
1123
|
+
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
1124
|
}
|
|
1115
|
-
for (const
|
|
1116
|
-
if (!
|
|
1117
|
-
const a = r.get(
|
|
1118
|
-
await this.notifyChange({ path:
|
|
1125
|
+
for (const n of r.keys())
|
|
1126
|
+
if (!i.has(n)) {
|
|
1127
|
+
const a = r.get(n);
|
|
1128
|
+
await this.notifyChange({ path: n, type: "removed", isDirectory: a?.isDirectory ?? !1 });
|
|
1119
1129
|
}
|
|
1120
|
-
this.watchers.set(t,
|
|
1130
|
+
this.watchers.set(t, i);
|
|
1121
1131
|
})
|
|
1122
1132
|
);
|
|
1123
1133
|
} finally {
|
|
@@ -1157,19 +1167,19 @@ class wt {
|
|
|
1157
1167
|
await this.ensureMounted();
|
|
1158
1168
|
try {
|
|
1159
1169
|
(r?.cleanBefore ?? !1) && await this.clear("/");
|
|
1160
|
-
for (const [
|
|
1161
|
-
const s =
|
|
1170
|
+
for (const [n, a] of t) {
|
|
1171
|
+
const s = F(n);
|
|
1162
1172
|
let o;
|
|
1163
1173
|
a instanceof Blob ? o = await ft(a) : o = a, await this.writeFile(s, o);
|
|
1164
1174
|
}
|
|
1165
1175
|
await this.notifyChange({ path: "/", type: "changed", isDirectory: !0 });
|
|
1166
|
-
} catch (
|
|
1167
|
-
throw
|
|
1176
|
+
} catch (i) {
|
|
1177
|
+
throw i instanceof c ? i : new c("Failed to sync file system", "SYNC_FAILED");
|
|
1168
1178
|
}
|
|
1169
1179
|
}
|
|
1170
1180
|
}
|
|
1171
|
-
typeof self < "u" && self.constructor.name === "DedicatedWorkerGlobalScope" &&
|
|
1172
|
-
//# sourceMappingURL=worker-
|
|
1181
|
+
typeof self < "u" && self.constructor.name === "DedicatedWorkerGlobalScope" && x(new wt());
|
|
1182
|
+
//# sourceMappingURL=worker-DilNsKoO.js.map
|
|
1173
1183
|
`, r = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", a], { type: "text/javascript;charset=utf-8" });
|
|
1174
1184
|
function o(t) {
|
|
1175
1185
|
let n;
|
|
@@ -1197,25 +1207,25 @@ function c(t) {
|
|
|
1197
1207
|
return t && n.setOptions(t), n;
|
|
1198
1208
|
}
|
|
1199
1209
|
export {
|
|
1200
|
-
|
|
1201
|
-
|
|
1210
|
+
d as DirectoryNotFoundError,
|
|
1211
|
+
f as FileNotFoundError,
|
|
1202
1212
|
p as OPFSError,
|
|
1203
1213
|
u as OPFSNotMountedError,
|
|
1204
1214
|
y as OPFSNotSupportedError,
|
|
1205
|
-
|
|
1206
|
-
|
|
1215
|
+
m as PathError,
|
|
1216
|
+
w as PermissionError,
|
|
1207
1217
|
g as StorageError,
|
|
1208
1218
|
v as TimeoutError,
|
|
1209
1219
|
b as basename,
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1220
|
+
E as calculateFileHash,
|
|
1221
|
+
S as checkOPFSSupport,
|
|
1222
|
+
F as convertBlobToUint8Array,
|
|
1213
1223
|
P as createBuffer,
|
|
1214
1224
|
c as createWorker,
|
|
1215
1225
|
x as decodeBuffer,
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1226
|
+
D as dirname,
|
|
1227
|
+
T as encodeString,
|
|
1228
|
+
C as extname,
|
|
1219
1229
|
A as joinPath,
|
|
1220
1230
|
O as normalizePath,
|
|
1221
1231
|
_ as readFileData,
|