@php-wasm/stream-compression 1.0.29 → 1.1.0
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/index.cjs +1 -1
- package/index.cjs.map +1 -1
- package/index.js +123 -125
- package/index.js.map +1 -1
- package/package.json +12 -5
- package/utils/iterator-to-stream.d.ts +1 -1
- package/utils/streamed-file.d.ts +6 -2
- package/zip/decode-remote-zip.d.ts +2 -2
- package/zip/decode-zip.d.ts +2 -2
package/index.js
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
1
|
import "@php-wasm/node-polyfills";
|
|
2
2
|
import { Semaphore as B } from "@php-wasm/util";
|
|
3
3
|
function U(...e) {
|
|
4
|
-
const
|
|
5
|
-
e.reduce((
|
|
4
|
+
const r = new Uint8Array(
|
|
5
|
+
e.reduce((n, a) => n + a.length, 0)
|
|
6
6
|
);
|
|
7
7
|
let t = 0;
|
|
8
|
-
for (const
|
|
9
|
-
|
|
10
|
-
return
|
|
8
|
+
for (const n of e)
|
|
9
|
+
r.set(n, t), t += n.length;
|
|
10
|
+
return r;
|
|
11
11
|
}
|
|
12
12
|
function S(e) {
|
|
13
13
|
if (e === void 0) {
|
|
14
|
-
let
|
|
14
|
+
let r = new Uint8Array();
|
|
15
15
|
return new TransformStream({
|
|
16
16
|
transform(t) {
|
|
17
|
-
|
|
17
|
+
r = U(r, t);
|
|
18
18
|
},
|
|
19
19
|
flush(t) {
|
|
20
|
-
t.enqueue(
|
|
20
|
+
t.enqueue(r);
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
} else {
|
|
24
|
-
const
|
|
24
|
+
const r = new ArrayBuffer(e || 0);
|
|
25
25
|
let t = 0;
|
|
26
26
|
return new TransformStream({
|
|
27
|
-
transform(
|
|
28
|
-
new Uint8Array(
|
|
27
|
+
transform(n) {
|
|
28
|
+
new Uint8Array(r).set(n, t), t += n.byteLength;
|
|
29
29
|
},
|
|
30
|
-
flush(
|
|
31
|
-
|
|
30
|
+
flush(n) {
|
|
31
|
+
n.enqueue(new Uint8Array(r));
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
function A(e,
|
|
37
|
-
if (
|
|
36
|
+
function A(e, r) {
|
|
37
|
+
if (r === 0)
|
|
38
38
|
return new ReadableStream({
|
|
39
39
|
start(a) {
|
|
40
40
|
a.close();
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
const t = e.getReader({ mode: "byob" });
|
|
44
|
-
let
|
|
44
|
+
let n = 0;
|
|
45
45
|
return new ReadableStream({
|
|
46
46
|
async pull(a) {
|
|
47
47
|
const { value: i, done: s } = await t.read(
|
|
48
|
-
new Uint8Array(
|
|
48
|
+
new Uint8Array(r - n)
|
|
49
49
|
);
|
|
50
50
|
if (s) {
|
|
51
51
|
t.releaseLock(), a.close();
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
n += i.length, a.enqueue(i), n >= r && (t.releaseLock(), a.close());
|
|
55
55
|
},
|
|
56
56
|
cancel() {
|
|
57
57
|
t.cancel();
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
async function c(e,
|
|
62
|
-
return
|
|
61
|
+
async function c(e, r) {
|
|
62
|
+
return r !== void 0 && (e = A(e, r)), await e.pipeThrough(S(r)).getReader().read().then(({ value: t }) => t);
|
|
63
63
|
}
|
|
64
|
-
async function re(e,
|
|
65
|
-
return new File([await c(
|
|
64
|
+
async function re(e, r) {
|
|
65
|
+
return new File([await c(r)], e);
|
|
66
66
|
}
|
|
67
67
|
function _(e) {
|
|
68
68
|
if (e instanceof ReadableStream)
|
|
69
69
|
return e;
|
|
70
|
-
let
|
|
71
|
-
return Symbol.asyncIterator in e ?
|
|
70
|
+
let r;
|
|
71
|
+
return Symbol.asyncIterator in e ? r = e[Symbol.asyncIterator]() : Symbol.iterator in e ? r = e[Symbol.iterator]() : r = e, new ReadableStream({
|
|
72
72
|
async pull(t) {
|
|
73
|
-
const { done:
|
|
74
|
-
if (
|
|
73
|
+
const { done: n, value: a } = await r.next();
|
|
74
|
+
if (n) {
|
|
75
75
|
t.close();
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
@@ -85,10 +85,10 @@ class ae extends File {
|
|
|
85
85
|
*
|
|
86
86
|
* @param readableStream The readable stream containing the file data.
|
|
87
87
|
* @param name The name of the file.
|
|
88
|
-
* @param
|
|
88
|
+
* @param options An object containing options such as the MIME type and file size.
|
|
89
89
|
*/
|
|
90
|
-
constructor(
|
|
91
|
-
super([], t, { type:
|
|
90
|
+
constructor(r, t, n) {
|
|
91
|
+
super([], t, { type: n == null ? void 0 : n.type }), this.readableStream = r, this.filesize = n == null ? void 0 : n.filesize;
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
* Overrides the slice() method of the File class.
|
|
@@ -127,8 +127,8 @@ ReadableStream.prototype[Symbol.asyncIterator] || (ReadableStream.prototype[Symb
|
|
|
127
127
|
const e = this.getReader();
|
|
128
128
|
try {
|
|
129
129
|
for (; ; ) {
|
|
130
|
-
const { done:
|
|
131
|
-
if (
|
|
130
|
+
const { done: r, value: t } = await e.read();
|
|
131
|
+
if (r)
|
|
132
132
|
return;
|
|
133
133
|
yield t;
|
|
134
134
|
}
|
|
@@ -140,33 +140,33 @@ ReadableStream.prototype[Symbol.asyncIterator]);
|
|
|
140
140
|
const F = 32, h = 67324752, w = 33639248, g = 101010256, N = 0, E = 8;
|
|
141
141
|
function b(e) {
|
|
142
142
|
return new TransformStream({
|
|
143
|
-
transform(
|
|
144
|
-
e(
|
|
143
|
+
transform(r, t) {
|
|
144
|
+
e(r) && t.enqueue(r);
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
function q(e) {
|
|
149
|
-
let
|
|
149
|
+
let r = !1;
|
|
150
150
|
return new TransformStream({
|
|
151
|
-
async transform(t,
|
|
152
|
-
|
|
151
|
+
async transform(t, n) {
|
|
152
|
+
r || (r = !0, n.enqueue(e)), n.enqueue(t);
|
|
153
153
|
}
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
156
|
function x(e) {
|
|
157
157
|
return new TransformStream({
|
|
158
|
-
async transform(
|
|
159
|
-
t.enqueue(
|
|
158
|
+
async transform(r, t) {
|
|
159
|
+
t.enqueue(r);
|
|
160
160
|
},
|
|
161
|
-
async flush(
|
|
162
|
-
|
|
161
|
+
async flush(r) {
|
|
162
|
+
r.enqueue(e);
|
|
163
163
|
}
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
|
-
function p(e,
|
|
167
|
-
return M(e,
|
|
166
|
+
function p(e, r) {
|
|
167
|
+
return M(e, r).pipeThrough(
|
|
168
168
|
new TransformStream({
|
|
169
|
-
async transform(t,
|
|
169
|
+
async transform(t, n) {
|
|
170
170
|
const a = new File(
|
|
171
171
|
[t.bytes],
|
|
172
172
|
new TextDecoder().decode(t.path),
|
|
@@ -174,36 +174,36 @@ function p(e, n) {
|
|
|
174
174
|
type: t.isDirectory ? "directory" : void 0
|
|
175
175
|
}
|
|
176
176
|
);
|
|
177
|
-
|
|
177
|
+
n.enqueue(a);
|
|
178
178
|
}
|
|
179
179
|
})
|
|
180
180
|
);
|
|
181
181
|
}
|
|
182
182
|
const k = () => !0;
|
|
183
|
-
function M(e,
|
|
183
|
+
function M(e, r = k) {
|
|
184
184
|
return new ReadableStream({
|
|
185
|
-
async pull(
|
|
185
|
+
async pull(n) {
|
|
186
186
|
const a = await v(e);
|
|
187
187
|
if (!a) {
|
|
188
|
-
|
|
188
|
+
n.close();
|
|
189
189
|
return;
|
|
190
190
|
}
|
|
191
|
-
|
|
191
|
+
n.enqueue(a);
|
|
192
192
|
}
|
|
193
193
|
}).pipeThrough(
|
|
194
|
-
b(({ signature:
|
|
194
|
+
b(({ signature: n }) => n === h)
|
|
195
195
|
).pipeThrough(
|
|
196
|
-
b(
|
|
196
|
+
b(r)
|
|
197
197
|
);
|
|
198
198
|
}
|
|
199
199
|
async function v(e) {
|
|
200
200
|
const t = new DataView((await c(e, 4)).buffer).getUint32(0, !0);
|
|
201
201
|
return t === h ? await L(e, !0) : t === w ? await T(e, !0) : t === g ? await O(e, !0) : null;
|
|
202
202
|
}
|
|
203
|
-
async function L(e,
|
|
204
|
-
if (!
|
|
203
|
+
async function L(e, r = !1) {
|
|
204
|
+
if (!r && new DataView((await c(e, 4)).buffer).getUint32(0, !0) !== h)
|
|
205
205
|
return null;
|
|
206
|
-
const t = new DataView((await c(e, 26)).buffer),
|
|
206
|
+
const t = new DataView((await c(e, 26)).buffer), n = t.getUint16(22, !0), a = t.getUint16(24, !0), i = {
|
|
207
207
|
signature: h,
|
|
208
208
|
version: t.getUint32(0, !0),
|
|
209
209
|
generalPurpose: t.getUint16(2, !0),
|
|
@@ -214,7 +214,7 @@ async function L(e, n = !1) {
|
|
|
214
214
|
compressedSize: t.getUint32(14, !0),
|
|
215
215
|
uncompressedSize: t.getUint32(18, !0)
|
|
216
216
|
};
|
|
217
|
-
i.path = await c(e,
|
|
217
|
+
i.path = await c(e, n), i.isDirectory = R(i.path), i.extra = await c(e, a);
|
|
218
218
|
let s = A(e, i.compressedSize);
|
|
219
219
|
if (i.compressionMethod === E) {
|
|
220
220
|
const o = new Uint8Array(10);
|
|
@@ -224,10 +224,10 @@ async function L(e, n = !1) {
|
|
|
224
224
|
}
|
|
225
225
|
return i.bytes = await s.pipeThrough(S(i.uncompressedSize)).getReader().read().then(({ value: o }) => o), i;
|
|
226
226
|
}
|
|
227
|
-
async function T(e,
|
|
228
|
-
if (!
|
|
227
|
+
async function T(e, r = !1) {
|
|
228
|
+
if (!r && new DataView((await c(e, 4)).buffer).getUint32(0, !0) !== w)
|
|
229
229
|
return null;
|
|
230
|
-
const t = new DataView((await c(e, 42)).buffer),
|
|
230
|
+
const t = new DataView((await c(e, 42)).buffer), n = t.getUint16(24, !0), a = t.getUint16(26, !0), i = t.getUint16(28, !0), s = {
|
|
231
231
|
signature: w,
|
|
232
232
|
versionCreated: t.getUint16(0, !0),
|
|
233
233
|
versionNeeded: t.getUint16(2, !0),
|
|
@@ -243,18 +243,18 @@ async function T(e, n = !1) {
|
|
|
243
243
|
externalAttributes: t.getUint32(34, !0),
|
|
244
244
|
firstByteAt: t.getUint32(38, !0)
|
|
245
245
|
};
|
|
246
|
-
return s.lastByteAt = s.firstByteAt + F +
|
|
246
|
+
return s.lastByteAt = s.firstByteAt + F + n + i + a + s.compressedSize - 1, s.path = await c(e, n), s.isDirectory = R(s.path), s.extra = await c(e, a), s.fileComment = await c(
|
|
247
247
|
e,
|
|
248
248
|
i
|
|
249
249
|
), s;
|
|
250
250
|
}
|
|
251
251
|
function R(e) {
|
|
252
|
-
return e[e.byteLength - 1] ==
|
|
252
|
+
return e[e.byteLength - 1] == 47;
|
|
253
253
|
}
|
|
254
|
-
async function O(e,
|
|
255
|
-
if (!
|
|
254
|
+
async function O(e, r = !1) {
|
|
255
|
+
if (!r && new DataView((await c(e, 4)).buffer).getUint32(0, !0) !== g)
|
|
256
256
|
return null;
|
|
257
|
-
const t = new DataView((await c(e, 18)).buffer),
|
|
257
|
+
const t = new DataView((await c(e, 18)).buffer), n = {
|
|
258
258
|
signature: g,
|
|
259
259
|
numberOfDisks: t.getUint16(0, !0),
|
|
260
260
|
centralDirectoryStartDisk: t.getUint16(2, !0),
|
|
@@ -263,11 +263,11 @@ async function O(e, n = !1) {
|
|
|
263
263
|
centralDirectorySize: t.getUint32(8, !0),
|
|
264
264
|
centralDirectoryOffset: t.getUint32(12, !0)
|
|
265
265
|
}, a = t.getUint16(16, !0);
|
|
266
|
-
return
|
|
266
|
+
return n.comment = await c(e, a), n;
|
|
267
267
|
}
|
|
268
268
|
const P = 110 * 1024, I = 10 * 1024, z = 1024 * 1024 * 1, V = new B({ concurrency: 10 }), D = () => !0;
|
|
269
|
-
async function ie(e,
|
|
270
|
-
if (
|
|
269
|
+
async function ie(e, r = D) {
|
|
270
|
+
if (r === D) {
|
|
271
271
|
const d = await fetch(e);
|
|
272
272
|
return p(d.body);
|
|
273
273
|
}
|
|
@@ -276,7 +276,7 @@ async function ie(e, n = D) {
|
|
|
276
276
|
const d = await fetch(e);
|
|
277
277
|
return p(d.body);
|
|
278
278
|
}
|
|
279
|
-
const
|
|
279
|
+
const n = await fetch(e, {
|
|
280
280
|
headers: {
|
|
281
281
|
// 0-0 looks weird, doesn't it?
|
|
282
282
|
// The Range header is inclusive so it's actually
|
|
@@ -284,43 +284,43 @@ async function ie(e, n = D) {
|
|
|
284
284
|
Range: "bytes=0-0",
|
|
285
285
|
"Accept-Encoding": "none"
|
|
286
286
|
}
|
|
287
|
-
}), [a, i] =
|
|
287
|
+
}), [a, i] = n.body.tee(), s = a.getReader(), { value: o } = await s.read(), { done: f } = await s.read();
|
|
288
288
|
if (s.releaseLock(), a.cancel(), !((o == null ? void 0 : o.length) === 1 && f))
|
|
289
289
|
return p(i);
|
|
290
290
|
i.cancel();
|
|
291
291
|
const l = await $(e, t);
|
|
292
|
-
return H(l).pipeThrough(b(
|
|
292
|
+
return H(l).pipeThrough(b(r)).pipeThrough(G()).pipeThrough(
|
|
293
293
|
W(l)
|
|
294
294
|
);
|
|
295
295
|
}
|
|
296
296
|
function H(e) {
|
|
297
|
-
let
|
|
297
|
+
let r;
|
|
298
298
|
return new ReadableStream({
|
|
299
299
|
async start() {
|
|
300
|
-
|
|
300
|
+
r = await Z(e);
|
|
301
301
|
},
|
|
302
302
|
async pull(t) {
|
|
303
|
-
const
|
|
304
|
-
|
|
303
|
+
const n = await T(
|
|
304
|
+
r
|
|
305
305
|
);
|
|
306
|
-
if (!
|
|
306
|
+
if (!n) {
|
|
307
307
|
t.close();
|
|
308
308
|
return;
|
|
309
309
|
}
|
|
310
|
-
t.enqueue(
|
|
310
|
+
t.enqueue(n);
|
|
311
311
|
}
|
|
312
312
|
});
|
|
313
313
|
}
|
|
314
314
|
async function Z(e) {
|
|
315
|
-
const
|
|
316
|
-
let t = new Uint8Array(),
|
|
315
|
+
const r = P;
|
|
316
|
+
let t = new Uint8Array(), n = e.length;
|
|
317
317
|
do {
|
|
318
|
-
|
|
318
|
+
n = Math.max(0, n - r);
|
|
319
319
|
const a = Math.min(
|
|
320
|
-
|
|
320
|
+
n + r - 1,
|
|
321
321
|
e.length - 1
|
|
322
322
|
), i = await c(
|
|
323
|
-
await e.streamBytes(
|
|
323
|
+
await e.streamBytes(n, a)
|
|
324
324
|
);
|
|
325
325
|
t = U(i, t);
|
|
326
326
|
const s = new DataView(i.buffer);
|
|
@@ -331,36 +331,35 @@ async function Z(e) {
|
|
|
331
331
|
if (t.byteLength < u + 4)
|
|
332
332
|
throw new Error("Central directory not found");
|
|
333
333
|
const l = s.getUint32(u, !0);
|
|
334
|
-
if (l <
|
|
334
|
+
if (l < n) {
|
|
335
335
|
const d = await c(
|
|
336
|
-
await e.streamBytes(l,
|
|
336
|
+
await e.streamBytes(l, n - 1)
|
|
337
337
|
);
|
|
338
338
|
t = U(
|
|
339
339
|
d,
|
|
340
340
|
t
|
|
341
341
|
);
|
|
342
|
-
} else
|
|
343
|
-
l
|
|
344
|
-
|
|
345
|
-
));
|
|
342
|
+
} else l > n && (t = t.slice(
|
|
343
|
+
l - n
|
|
344
|
+
));
|
|
346
345
|
return new Blob([t]).stream();
|
|
347
346
|
}
|
|
348
|
-
} while (
|
|
347
|
+
} while (n >= 0);
|
|
349
348
|
throw new Error("Central directory not found");
|
|
350
349
|
}
|
|
351
350
|
function G() {
|
|
352
|
-
let e = 0,
|
|
351
|
+
let e = 0, r = [];
|
|
353
352
|
return new TransformStream({
|
|
354
|
-
transform(t,
|
|
355
|
-
t.firstByteAt > e + I && (
|
|
353
|
+
transform(t, n) {
|
|
354
|
+
t.firstByteAt > e + I && (n.enqueue(r), r = []), e = t.lastByteAt, r.push(t);
|
|
356
355
|
},
|
|
357
356
|
flush(t) {
|
|
358
|
-
t.enqueue(
|
|
357
|
+
t.enqueue(r);
|
|
359
358
|
}
|
|
360
359
|
});
|
|
361
360
|
}
|
|
362
361
|
function W(e) {
|
|
363
|
-
let
|
|
362
|
+
let r = !1, t = 0, n;
|
|
364
363
|
const a = [], i = new WritableStream({
|
|
365
364
|
write(o, f) {
|
|
366
365
|
o.length && (++t, Y(e, o).then((u) => {
|
|
@@ -372,20 +371,20 @@ function W(e) {
|
|
|
372
371
|
}));
|
|
373
372
|
},
|
|
374
373
|
abort() {
|
|
375
|
-
|
|
374
|
+
r = !0, n.close();
|
|
376
375
|
},
|
|
377
376
|
async close() {
|
|
378
|
-
|
|
377
|
+
r = !0;
|
|
379
378
|
}
|
|
380
379
|
});
|
|
381
380
|
return {
|
|
382
381
|
readable: new ReadableStream({
|
|
383
382
|
start(o) {
|
|
384
|
-
|
|
383
|
+
n = o;
|
|
385
384
|
},
|
|
386
385
|
async pull(o) {
|
|
387
386
|
for (; ; ) {
|
|
388
|
-
if (
|
|
387
|
+
if (r && !a.length && t === 0) {
|
|
389
388
|
o.close();
|
|
390
389
|
return;
|
|
391
390
|
}
|
|
@@ -410,35 +409,35 @@ function W(e) {
|
|
|
410
409
|
writable: i
|
|
411
410
|
};
|
|
412
411
|
}
|
|
413
|
-
async function Y(e,
|
|
412
|
+
async function Y(e, r) {
|
|
414
413
|
const t = await V.acquire();
|
|
415
414
|
try {
|
|
416
|
-
const
|
|
415
|
+
const n = r[r.length - 1];
|
|
417
416
|
return await e.streamBytes(
|
|
418
|
-
|
|
419
|
-
|
|
417
|
+
r[0].firstByteAt,
|
|
418
|
+
n.lastByteAt
|
|
420
419
|
);
|
|
421
420
|
} finally {
|
|
422
421
|
t();
|
|
423
422
|
}
|
|
424
423
|
}
|
|
425
424
|
async function C(e) {
|
|
426
|
-
return await fetch(e, { method: "HEAD" }).then((
|
|
427
|
-
if (!
|
|
425
|
+
return await fetch(e, { method: "HEAD" }).then((r) => r.headers.get("Content-Length")).then((r) => {
|
|
426
|
+
if (!r)
|
|
428
427
|
throw new Error("Content-Length header is missing");
|
|
429
|
-
const t = parseInt(
|
|
428
|
+
const t = parseInt(r, 10);
|
|
430
429
|
if (isNaN(t) || t < 0)
|
|
431
430
|
throw new Error("Content-Length header is invalid");
|
|
432
431
|
return t;
|
|
433
432
|
});
|
|
434
433
|
}
|
|
435
|
-
async function $(e,
|
|
436
|
-
return
|
|
437
|
-
length:
|
|
438
|
-
streamBytes: async (t,
|
|
434
|
+
async function $(e, r) {
|
|
435
|
+
return r === void 0 && (r = await C(e)), {
|
|
436
|
+
length: r,
|
|
437
|
+
streamBytes: async (t, n) => await fetch(e, {
|
|
439
438
|
headers: {
|
|
440
439
|
// The Range header is inclusive, so we need to subtract 1
|
|
441
|
-
Range: `bytes=${t}-${
|
|
440
|
+
Range: `bytes=${t}-${n - 1}`,
|
|
442
441
|
"Accept-Encoding": "none"
|
|
443
442
|
}
|
|
444
443
|
}).then((a) => a.body)
|
|
@@ -449,9 +448,9 @@ function se(e) {
|
|
|
449
448
|
}
|
|
450
449
|
function K() {
|
|
451
450
|
const e = /* @__PURE__ */ new Map();
|
|
452
|
-
let
|
|
451
|
+
let r = 0;
|
|
453
452
|
return new TransformStream({
|
|
454
|
-
async transform(t,
|
|
453
|
+
async transform(t, n) {
|
|
455
454
|
const a = new Uint8Array(await t.arrayBuffer());
|
|
456
455
|
let i = await c(
|
|
457
456
|
new Blob([a]).stream().pipeThrough(new CompressionStream("gzip"))
|
|
@@ -474,12 +473,12 @@ function K() {
|
|
|
474
473
|
path: o,
|
|
475
474
|
extra: new Uint8Array(0)
|
|
476
475
|
};
|
|
477
|
-
e.set(
|
|
476
|
+
e.set(r, f);
|
|
478
477
|
const u = j(f);
|
|
479
|
-
|
|
478
|
+
n.enqueue(u), r += u.byteLength, n.enqueue(i), r += i.byteLength;
|
|
480
479
|
},
|
|
481
480
|
flush(t) {
|
|
482
|
-
const
|
|
481
|
+
const n = r;
|
|
483
482
|
let a = 0;
|
|
484
483
|
for (const [
|
|
485
484
|
o,
|
|
@@ -491,8 +490,7 @@ function K() {
|
|
|
491
490
|
fileComment: new Uint8Array(0),
|
|
492
491
|
diskNumber: 1,
|
|
493
492
|
internalAttributes: 0,
|
|
494
|
-
externalAttributes: 0
|
|
495
|
-
firstByteAt: o
|
|
493
|
+
externalAttributes: 0
|
|
496
494
|
}, l = J(
|
|
497
495
|
u,
|
|
498
496
|
o
|
|
@@ -502,7 +500,7 @@ function K() {
|
|
|
502
500
|
const i = {
|
|
503
501
|
signature: g,
|
|
504
502
|
numberOfDisks: 1,
|
|
505
|
-
centralDirectoryOffset:
|
|
503
|
+
centralDirectoryOffset: n,
|
|
506
504
|
centralDirectorySize: a,
|
|
507
505
|
centralDirectoryStartDisk: 1,
|
|
508
506
|
numberCentralDirectoryRecordsOnThisDisk: e.size,
|
|
@@ -514,26 +512,26 @@ function K() {
|
|
|
514
512
|
});
|
|
515
513
|
}
|
|
516
514
|
function j(e) {
|
|
517
|
-
const
|
|
515
|
+
const r = new ArrayBuffer(
|
|
518
516
|
30 + e.path.byteLength + e.extra.byteLength
|
|
519
|
-
), t = new DataView(
|
|
517
|
+
), t = new DataView(r);
|
|
520
518
|
t.setUint32(0, e.signature, !0), t.setUint16(4, e.version, !0), t.setUint16(6, e.generalPurpose, !0), t.setUint16(8, e.compressionMethod, !0), t.setUint16(10, e.lastModifiedDate, !0), t.setUint16(12, e.lastModifiedTime, !0), t.setUint32(14, e.crc, !0), t.setUint32(18, e.compressedSize, !0), t.setUint32(22, e.uncompressedSize, !0), t.setUint16(26, e.path.byteLength, !0), t.setUint16(28, e.extra.byteLength, !0);
|
|
521
|
-
const
|
|
522
|
-
return
|
|
519
|
+
const n = new Uint8Array(r);
|
|
520
|
+
return n.set(e.path, 30), n.set(e.extra, 30 + e.path.byteLength), n;
|
|
523
521
|
}
|
|
524
|
-
function J(e,
|
|
522
|
+
function J(e, r) {
|
|
525
523
|
const t = new ArrayBuffer(
|
|
526
524
|
46 + e.path.byteLength + e.extra.byteLength
|
|
527
|
-
),
|
|
528
|
-
|
|
525
|
+
), n = new DataView(t);
|
|
526
|
+
n.setUint32(0, e.signature, !0), n.setUint16(4, e.versionCreated, !0), n.setUint16(6, e.versionNeeded, !0), n.setUint16(8, e.generalPurpose, !0), n.setUint16(10, e.compressionMethod, !0), n.setUint16(12, e.lastModifiedDate, !0), n.setUint16(14, e.lastModifiedTime, !0), n.setUint32(16, e.crc, !0), n.setUint32(20, e.compressedSize, !0), n.setUint32(24, e.uncompressedSize, !0), n.setUint16(28, e.path.byteLength, !0), n.setUint16(30, e.extra.byteLength, !0), n.setUint16(32, e.fileComment.byteLength, !0), n.setUint16(34, e.diskNumber, !0), n.setUint16(36, e.internalAttributes, !0), n.setUint32(38, e.externalAttributes, !0), n.setUint32(42, r, !0);
|
|
529
527
|
const a = new Uint8Array(t);
|
|
530
528
|
return a.set(e.path, 46), a.set(e.extra, 46 + e.path.byteLength), a;
|
|
531
529
|
}
|
|
532
530
|
function Q(e) {
|
|
533
|
-
const
|
|
531
|
+
const r = new ArrayBuffer(22 + e.comment.byteLength), t = new DataView(r);
|
|
534
532
|
t.setUint32(0, e.signature, !0), t.setUint16(4, e.numberOfDisks, !0), t.setUint16(6, e.centralDirectoryStartDisk, !0), t.setUint16(8, e.numberCentralDirectoryRecordsOnThisDisk, !0), t.setUint16(10, e.numberCentralDirectoryRecords, !0), t.setUint32(12, e.centralDirectorySize, !0), t.setUint32(16, e.centralDirectoryOffset, !0), t.setUint16(20, e.comment.byteLength, !0);
|
|
535
|
-
const
|
|
536
|
-
return
|
|
533
|
+
const n = new Uint8Array(r);
|
|
534
|
+
return n.set(e.comment, 22), n;
|
|
537
535
|
}
|
|
538
536
|
export {
|
|
539
537
|
ae as StreamedFile,
|