@zip.js/zip.js 2.6.11 → 2.6.14
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/cli-deno/mc-zip.js +1 -1
- package/dist/zip-fs-full.js +26 -17
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +26 -17
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +25 -16
- 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 +25 -16
- package/dist/zip.min.js +1 -1
- package/index.d.ts +3 -2
- package/lib/core/io.js +11 -10
- package/lib/core/util/cp437-decode.js +12 -5
- package/lib/core/zip-fs-core.js +1 -1
- package/lib/core/zip-reader.js +2 -1
- package/package.json +16 -7
- package/tests/all/loader.html +2 -4
- package/tests/all/test-abort-signal-read.js +0 -1
- package/tests/all/test-abort-signal-write.js +0 -1
- package/tests/all/test-array.js +3 -1
- package/tests/all/test-base64.js +3 -1
- package/tests/all/test-blob.js +5 -1
- package/tests/all/test-codecs-interoperability.js +3 -1
- package/tests/all/test-crc.js +7 -12
- package/tests/all/test-crypto.js +3 -1
- package/tests/all/test-custom-io.js +3 -1
- package/tests/all/test-data-descriptor-signature.js +7 -1
- package/tests/all/test-data-descriptor.js +7 -1
- package/tests/all/test-duplicated-filename.js +1 -1
- package/tests/all/test-empty.js +3 -1
- package/tests/all/test-extended-timestamp.js +3 -1
- package/tests/all/test-extra-field.js +3 -2
- package/tests/all/test-fflate-no-worker.js +3 -1
- package/tests/all/test-fflate.js +3 -1
- package/tests/all/test-fs-base64.js +3 -1
- package/tests/all/test-fs-export-options.js +3 -1
- package/tests/all/test-fs-http-import.js +3 -1
- package/tests/all/test-fs-http-reader.js +3 -1
- package/tests/all/test-fs-replace.js +3 -1
- package/tests/all/test-fs-streams.js +3 -1
- package/tests/all/test-fs-text.js +3 -1
- package/tests/all/test-fs-unzip-store.js +3 -1
- package/tests/all/test-fs.js +3 -1
- package/tests/all/test-http-crypto.js +3 -2
- package/tests/all/test-http-range.js +3 -2
- package/tests/all/test-http-zip64.js +3 -2
- package/tests/all/test-invalid-crc.js +3 -1
- package/tests/all/test-no-worker.js +3 -1
- package/tests/all/test-pako-no-worker.js +3 -1
- package/tests/all/test-pako.js +3 -1
- package/tests/all/test-parallel-reads.js +3 -1
- package/tests/all/test-parallel-writes-auto-buffered.js +3 -1
- package/tests/all/test-parallel-writes-ordered.js +4 -2
- package/tests/all/test-parallel-writes.js +3 -1
- package/tests/all/test-readable-stream.js +8 -12
- package/tests/all/test-readable-zip-stream.js +3 -2
- package/tests/all/test-safe-closing.js +3 -1
- package/tests/all/test-store.js +9 -1
- package/tests/all/test-sw-worker.js +0 -1
- package/tests/all/test-sw.js +0 -1
- package/tests/all/test-worker-timeout.js +7 -12
- package/tests/all/test-wrapped.js +4 -2
- package/tests/all/test-writable-stream.js +23 -25
- package/tests/all/test-zip64-auto.js +3 -1
- package/tests/all/test-zip64-crypto.js +3 -1
- package/tests/all/test-zip64.js +3 -1
- package/tests/all/test-zipcrypto.js +3 -1
- package/tests/node-runner.js +17 -9
- package/build.sh +0 -3
- package/tests/run-tests.sh +0 -3
package/cli-deno/mc-zip.js
CHANGED
|
@@ -36,7 +36,7 @@ async function displayUsage() {
|
|
|
36
36
|
await stdout.write(" --data-descriptor-signature add data descriptor signatures (default: false)\n");
|
|
37
37
|
await stdout.write(" --keep-order keep entries order (default: true)\n");
|
|
38
38
|
await stdout.write(" --zip64 use Zip64 format (default: false)\n");
|
|
39
|
-
await stdout.write(" --prevent-parent-directories remove occurences of \"../\" in filenames\n");
|
|
39
|
+
await stdout.write(" --prevent-parent-directories remove occurences of \"../\" in filenames (default: true)\n");
|
|
40
40
|
await stdout.write("\n");
|
|
41
41
|
Deno.exit(-1);
|
|
42
42
|
}
|
package/dist/zip-fs-full.js
CHANGED
|
@@ -7951,18 +7951,19 @@
|
|
|
7951
7951
|
|
|
7952
7952
|
class Uint8ArrayWriter extends Writer {
|
|
7953
7953
|
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
this.array = new Uint8Array();
|
|
7954
|
+
init(initSize = 0) {
|
|
7955
|
+
this.array = new Uint8Array(initSize);
|
|
7957
7956
|
}
|
|
7958
7957
|
|
|
7959
7958
|
writeUint8Array(array) {
|
|
7960
|
-
super.writeUint8Array(array);
|
|
7961
7959
|
const writer = this;
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7960
|
+
if (writer.size + array.length > writer.array.length) {
|
|
7961
|
+
const previousArray = writer.array;
|
|
7962
|
+
writer.array = new Uint8Array(previousArray.length + array.length);
|
|
7963
|
+
writer.array.set(previousArray);
|
|
7964
|
+
}
|
|
7965
|
+
writer.array.set(array, writer.size);
|
|
7966
|
+
super.writeUint8Array(array);
|
|
7966
7967
|
}
|
|
7967
7968
|
|
|
7968
7969
|
getData() {
|
|
@@ -7976,9 +7977,9 @@
|
|
|
7976
7977
|
return protocol == "http:" || protocol == "https:";
|
|
7977
7978
|
}
|
|
7978
7979
|
|
|
7979
|
-
async function initStream(stream) {
|
|
7980
|
+
async function initStream(stream, initSize) {
|
|
7980
7981
|
if (stream.init && !stream.initialized) {
|
|
7981
|
-
await stream.init();
|
|
7982
|
+
await stream.init(initSize);
|
|
7982
7983
|
}
|
|
7983
7984
|
}
|
|
7984
7985
|
|
|
@@ -8080,14 +8081,21 @@
|
|
|
8080
8081
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8081
8082
|
*/
|
|
8082
8083
|
|
|
8084
|
+
/* global TextDecoder */
|
|
8085
|
+
|
|
8083
8086
|
const CP437 = "\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split("");
|
|
8087
|
+
const VALID_CP437 = CP437.length == 256;
|
|
8084
8088
|
|
|
8085
|
-
var decodeCP437 = stringValue => {
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
|
|
8089
|
+
var decodeCP437 = (stringValue) => {
|
|
8090
|
+
if (VALID_CP437) {
|
|
8091
|
+
let result = "";
|
|
8092
|
+
for (let indexCharacter = 0; indexCharacter < stringValue.length; indexCharacter++) {
|
|
8093
|
+
result += CP437[stringValue[indexCharacter]];
|
|
8094
|
+
}
|
|
8095
|
+
return result;
|
|
8096
|
+
} else {
|
|
8097
|
+
return new TextDecoder().decode(stringValue);
|
|
8089
8098
|
}
|
|
8090
|
-
return result;
|
|
8091
8099
|
};
|
|
8092
8100
|
|
|
8093
8101
|
/*
|
|
@@ -8390,6 +8398,7 @@
|
|
|
8390
8398
|
bitFlag,
|
|
8391
8399
|
signature,
|
|
8392
8400
|
rawLastModDate,
|
|
8401
|
+
uncompressedSize,
|
|
8393
8402
|
compressedSize
|
|
8394
8403
|
} = zipEntry;
|
|
8395
8404
|
const localDirectory = zipEntry.localDirectory = {};
|
|
@@ -8430,7 +8439,7 @@
|
|
|
8430
8439
|
readable.size = size;
|
|
8431
8440
|
const { writable } = writer;
|
|
8432
8441
|
const signal = getOptionValue$1(zipEntry, options, "signal");
|
|
8433
|
-
await initStream(writer);
|
|
8442
|
+
await initStream(writer, uncompressedSize);
|
|
8434
8443
|
const { onstart, onprogress, onend } = options;
|
|
8435
8444
|
const workerOptions = {
|
|
8436
8445
|
options: {
|
|
@@ -9579,7 +9588,7 @@
|
|
|
9579
9588
|
return zipEntry.data;
|
|
9580
9589
|
} else {
|
|
9581
9590
|
const reader = zipEntry.reader = new zipEntry.Reader(zipEntry.data, options);
|
|
9582
|
-
await Promise.all([initStream(reader), initStream(writer)]);
|
|
9591
|
+
await Promise.all([initStream(reader), initStream(writer, zipEntry.data.uncompressedSize)]);
|
|
9583
9592
|
zipEntry.uncompressedSize = reader.size;
|
|
9584
9593
|
const readable = reader.readable;
|
|
9585
9594
|
readable.size = () => reader.size;
|