@zip.js/zip.js 2.6.29 → 2.6.30
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/dist/z-worker-fflate.js +1 -1
- package/dist/z-worker-pako.js +1 -1
- package/dist/z-worker.js +1 -1
- package/dist/zip-fs-full.js +134 -39
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +135 -39
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +135 -39
- package/dist/zip-full.min.js +1 -1
- package/dist/zip-no-worker-deflate.min.js +1 -1
- package/dist/zip-no-worker-inflate.min.js +1 -1
- package/dist/zip-no-worker.min.js +1 -1
- package/dist/zip.js +1 -4532
- package/dist/zip.min.js +1 -1
- package/index-fflate.js +3 -1
- package/index.cjs +133 -38
- package/index.d.ts +8 -2
- package/index.js +3 -1
- package/lib/core/codec-pool-worker.js +14 -3
- package/lib/core/io.js +54 -2
- package/lib/core/zip-reader.js +70 -35
- package/lib/z-worker-inline.js +1 -1
- package/package.json +1 -1
- package/rollup-fflate.config.dev.js +2 -2
- package/rollup-fflate.config.js +2 -2
- package/rollup.config.dev.js +2 -2
- package/rollup.config.js +5 -5
- package/tests/all/test-split-zip.js +37 -0
- package/tests/data/lorem-split.z01 +0 -0
- package/tests/data/lorem-split.z02 +0 -0
- package/tests/data/lorem-split.z03 +0 -0
- package/tests/data/lorem-split.z04 +0 -0
- package/tests/data/lorem-split.z05 +0 -0
- package/tests/data/lorem-split.z06 +0 -0
- package/tests/data/lorem-split.z07 +0 -0
- package/tests/data/lorem-split.zip +0 -0
- package/tests/tests-data.js +1 -0
package/rollup.config.js
CHANGED
|
@@ -34,8 +34,8 @@ const inlineTerserOptions = {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
const GLOBALS = "const { Array, Object, String, Number, BigInt, Math, Date, Map, Set, Response, URL, Error, Uint8Array, Uint16Array, Uint32Array, DataView, Blob, Promise, TextEncoder, TextDecoder, document, crypto, btoa, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream, navigator } = globalThis;";
|
|
38
|
-
const GLOBALS_WORKER = "const { Array, Object, Math, Error, Uint8Array, Uint16Array, Uint32Array, Int32Array, Map, DataView, Promise, TextEncoder, crypto, postMessage, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream } =
|
|
37
|
+
const GLOBALS = "const { Array, Object, String, Number, BigInt, Math, Date, Map, Set, Response, URL, Error, Uint8Array, Uint16Array, Uint32Array, DataView, Blob, Promise, TextEncoder, TextDecoder, document, crypto, btoa, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream, navigator } = typeof globalThis !== 'undefined' ? globalThis : this || self;";
|
|
38
|
+
const GLOBALS_WORKER = "const { Array, Object, Math, Error, Uint8Array, Uint16Array, Uint32Array, Int32Array, Map, DataView, Promise, TextEncoder, crypto, postMessage, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream } = self;";
|
|
39
39
|
|
|
40
40
|
export default [{
|
|
41
41
|
input: "lib/z-worker.js",
|
|
@@ -64,14 +64,14 @@ export default [{
|
|
|
64
64
|
intro: GLOBALS,
|
|
65
65
|
file: "dist/zip.min.js",
|
|
66
66
|
format: "umd",
|
|
67
|
-
name: "zip"
|
|
68
|
-
plugins: [terser(bundledTerserOptions)]
|
|
67
|
+
name: "zip"
|
|
69
68
|
}, {
|
|
70
69
|
intro: GLOBALS,
|
|
71
70
|
file: "dist/zip.js",
|
|
72
71
|
format: "umd",
|
|
73
72
|
name: "zip"
|
|
74
|
-
}]
|
|
73
|
+
}],
|
|
74
|
+
plugins: [terser(bundledTerserOptions)]
|
|
75
75
|
}, {
|
|
76
76
|
input: ["lib/zip-full.js"],
|
|
77
77
|
output: [{
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* global URL */
|
|
2
|
+
|
|
3
|
+
import * as zip from "../../index.js";
|
|
4
|
+
|
|
5
|
+
const PATHS = [
|
|
6
|
+
"./../data/lorem-split.z01",
|
|
7
|
+
"./../data/lorem-split.z02",
|
|
8
|
+
"./../data/lorem-split.z03",
|
|
9
|
+
"./../data/lorem-split.z04",
|
|
10
|
+
"./../data/lorem-split.z05",
|
|
11
|
+
"./../data/lorem-split.z06",
|
|
12
|
+
"./../data/lorem-split.z07",
|
|
13
|
+
"./../data/lorem-split.zip",
|
|
14
|
+
];
|
|
15
|
+
const UNCOMPRESSED_SIZES = [
|
|
16
|
+
1162,
|
|
17
|
+
204946,
|
|
18
|
+
603889,
|
|
19
|
+
809738
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
export { test };
|
|
23
|
+
|
|
24
|
+
async function test() {
|
|
25
|
+
zip.configure({ chunkSize: 16 * 1024, useWebWorkers: true });
|
|
26
|
+
const readers = PATHS.map(url => new zip.HttpReader(new URL(url, import.meta.url).href, { preventHeadRequest: true }));
|
|
27
|
+
const zipReader = new zip.ZipReader(new zip.SplitZipReader(readers));
|
|
28
|
+
const entries = await zipReader.getEntries();
|
|
29
|
+
const results = await Promise.all(UNCOMPRESSED_SIZES.map(async (uncompressedSize, indexEntry) =>
|
|
30
|
+
(await entries[indexEntry].getData(new zip.TextWriter())).length == uncompressedSize
|
|
31
|
+
));
|
|
32
|
+
await zipReader.close();
|
|
33
|
+
zip.terminateWorkers();
|
|
34
|
+
if (results.includes(false)) {
|
|
35
|
+
throw new Error();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/tests/tests-data.js
CHANGED
|
@@ -41,6 +41,7 @@ export default ([
|
|
|
41
41
|
{ title: "Safe closing", script: "./test-safe-closing.js" },
|
|
42
42
|
{ title: "Service worker", script: "./test-sw.js", env: ["browser"] },
|
|
43
43
|
{ title: "Signature CRC32", script: "./test-crc.js" },
|
|
44
|
+
{ title: "Split files", script: "./test-split-zip.js", env: ["deno", "browser"] },
|
|
44
45
|
{ title: "Store", script: "./test-store.js" },
|
|
45
46
|
{ title: "Streams", script: "./test-streams.js" },
|
|
46
47
|
{ title: "Worker timeout", script: "./test-worker-timeout.js" },
|