@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/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 } = globalThis;";
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
@@ -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" },