@zip.js/zip.js 2.8.59 → 2.8.60
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/deno.json +2 -2
- package/dist/zip-core-external.js +139 -19
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +115 -2
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +139 -19
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +5298 -3908
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +139 -19
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +117 -4
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +142 -19
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +117 -4
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +117 -4
- package/dist/zip-native.min.js +1 -1
- package/dist/zip-web-worker-native.js +1 -1
- package/dist/zip-web-worker.js +1 -1
- package/dist/zip.js +142 -19
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +117 -4
- package/index-native.min.js +1 -1
- package/index.cjs +142 -19
- package/index.d.cts +134 -1
- package/index.d.ts +134 -1
- package/index.min.js +1 -1
- package/lib/core/codec-registry.js +5 -0
- package/lib/core/compression-methods.js +93 -0
- package/lib/core/streams/zip-entry-stream.js +7 -3
- package/lib/core/streams/zlib-wasm/zlib-streams.js +18 -8
- package/lib/core/version.js +31 -0
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/zip-writer.js +1 -0
- package/lib/zip-core-base.js +7 -0
- package/lib/zip-fs-core.js +32 -0
- package/package.json +3 -3
- package/sync-versions.js +26 -0
package/dist/zip-core.js
CHANGED
|
@@ -2082,6 +2082,10 @@
|
|
|
2082
2082
|
return registeredCodecs.get(compressionMethod);
|
|
2083
2083
|
}
|
|
2084
2084
|
|
|
2085
|
+
function getRegisteredCodecs() {
|
|
2086
|
+
return Array.from(registeredCodecs.values(), codec => Object.assign({}, codec, codecStreams.get(codec.format)));
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2085
2089
|
function getCodecStreams(format) {
|
|
2086
2090
|
return codecStreams.get(format);
|
|
2087
2091
|
}
|
|
@@ -2145,7 +2149,7 @@
|
|
|
2145
2149
|
|
|
2146
2150
|
constructor(options, { chunkSize, CompressionStreamFallback, CompressionStream }) {
|
|
2147
2151
|
super({});
|
|
2148
|
-
const { compressed, encrypted, useCompressionStream, zipCrypto, computeCrc32, level, deflate64, format, compressionMethod } = options;
|
|
2152
|
+
const { compressed, encrypted, useCompressionStream, zipCrypto, computeCrc32, level, deflate64, format, compressionMethod, inputSize } = options;
|
|
2149
2153
|
const stream = this;
|
|
2150
2154
|
let crc32Stream, encryptionStream, gzipCrc32Stream;
|
|
2151
2155
|
let readable = super.readable;
|
|
@@ -2158,7 +2162,7 @@
|
|
|
2158
2162
|
}
|
|
2159
2163
|
if (compressed) {
|
|
2160
2164
|
if (codecStreams) {
|
|
2161
|
-
readable = pipeThroughBackpressured(readable, createCodecStream(codecStreams.CompressionStream, format, { level, chunkSize, compressionMethod }));
|
|
2165
|
+
readable = pipeThroughBackpressured(readable, createCodecStream(codecStreams.CompressionStream, format, { level, chunkSize, compressionMethod, uncompressedSize: inputSize }));
|
|
2162
2166
|
} else if (useGzipCrc32) {
|
|
2163
2167
|
gzipCrc32Stream = new GzipToRawDeflateStream();
|
|
2164
2168
|
readable = pipeThroughBackpressured(readable, new CompressionStream(FORMAT_GZIP));
|
|
@@ -7323,6 +7327,7 @@
|
|
|
7323
7327
|
const workerOptions = {
|
|
7324
7328
|
options: {
|
|
7325
7329
|
codecType: CODEC_DEFLATE,
|
|
7330
|
+
inputSize: size,
|
|
7326
7331
|
level,
|
|
7327
7332
|
rawPassword,
|
|
7328
7333
|
password,
|
|
@@ -8433,6 +8438,111 @@
|
|
|
8433
8438
|
*/
|
|
8434
8439
|
|
|
8435
8440
|
|
|
8441
|
+
function getSupportedCompressionMethods() {
|
|
8442
|
+
const { CompressionStream, DecompressionStream, CompressionStreamFallback, DecompressionStreamFallback } = getConfiguration();
|
|
8443
|
+
const supportedMethods = [{
|
|
8444
|
+
compressionMethod: COMPRESSION_METHOD_STORE,
|
|
8445
|
+
compression: true,
|
|
8446
|
+
decompression: true,
|
|
8447
|
+
registered: false
|
|
8448
|
+
}, {
|
|
8449
|
+
compressionMethod: COMPRESSION_METHOD_DEFLATE,
|
|
8450
|
+
compression: formatSupported(CompressionStreamFallback, FORMAT_DEFLATE_RAW) ||
|
|
8451
|
+
formatSupported(CompressionStream, FORMAT_DEFLATE_RAW) || formatSupported(CompressionStream, FORMAT_GZIP),
|
|
8452
|
+
decompression: formatSupported(DecompressionStreamFallback, FORMAT_DEFLATE_RAW) ||
|
|
8453
|
+
formatSupported(DecompressionStream, FORMAT_DEFLATE_RAW) || formatSupported(DecompressionStream, FORMAT_GZIP),
|
|
8454
|
+
registered: false
|
|
8455
|
+
}, {
|
|
8456
|
+
compressionMethod: COMPRESSION_METHOD_DEFLATE_64,
|
|
8457
|
+
compression: false,
|
|
8458
|
+
decompression: formatSupported(DecompressionStreamFallback, FORMAT_DEFLATE64_RAW) ||
|
|
8459
|
+
formatSupported(DecompressionStream, FORMAT_DEFLATE64_RAW),
|
|
8460
|
+
registered: false
|
|
8461
|
+
}];
|
|
8462
|
+
for (const codec of getRegisteredCodecs()) {
|
|
8463
|
+
const codecStreams = getCodecStreams(codec.format);
|
|
8464
|
+
supportedMethods.push({
|
|
8465
|
+
compressionMethod: codec.compressionMethod,
|
|
8466
|
+
// deno-lint-ignore valid-typeof
|
|
8467
|
+
compression: codecStreams ? typeof codecStreams.CompressionStream == FUNCTION_TYPE : UNDEFINED_VALUE,
|
|
8468
|
+
// deno-lint-ignore valid-typeof
|
|
8469
|
+
decompression: codecStreams ? typeof codecStreams.DecompressionStream == FUNCTION_TYPE : UNDEFINED_VALUE,
|
|
8470
|
+
registered: true
|
|
8471
|
+
});
|
|
8472
|
+
}
|
|
8473
|
+
return supportedMethods;
|
|
8474
|
+
}
|
|
8475
|
+
|
|
8476
|
+
function formatSupported(StreamClass, format) {
|
|
8477
|
+
if (!StreamClass) {
|
|
8478
|
+
return false;
|
|
8479
|
+
}
|
|
8480
|
+
const { supportedFormats } = StreamClass;
|
|
8481
|
+
if (supportedFormats) {
|
|
8482
|
+
return supportedFormats.includes(format);
|
|
8483
|
+
}
|
|
8484
|
+
return supportsFormat(StreamClass, format);
|
|
8485
|
+
}
|
|
8486
|
+
|
|
8487
|
+
/*
|
|
8488
|
+
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
8489
|
+
|
|
8490
|
+
Redistribution and use in source and binary forms, with or without
|
|
8491
|
+
modification, are permitted provided that the following conditions are met:
|
|
8492
|
+
|
|
8493
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
8494
|
+
this list of conditions and the following disclaimer.
|
|
8495
|
+
|
|
8496
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
8497
|
+
notice, this list of conditions and the following disclaimer in
|
|
8498
|
+
the documentation and/or other materials provided with the distribution.
|
|
8499
|
+
|
|
8500
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
8501
|
+
derived from this software without specific prior written permission.
|
|
8502
|
+
|
|
8503
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
8504
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
8505
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
8506
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
8507
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
8508
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
8509
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
8510
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
8511
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
8512
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8513
|
+
*/
|
|
8514
|
+
|
|
8515
|
+
const VERSION = "2.8.60";
|
|
8516
|
+
|
|
8517
|
+
/*
|
|
8518
|
+
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
8519
|
+
|
|
8520
|
+
Redistribution and use in source and binary forms, with or without
|
|
8521
|
+
modification, are permitted provided that the following conditions are met:
|
|
8522
|
+
|
|
8523
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
8524
|
+
this list of conditions and the following disclaimer.
|
|
8525
|
+
|
|
8526
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
8527
|
+
notice, this list of conditions and the following disclaimer in
|
|
8528
|
+
the documentation and/or other materials provided with the distribution.
|
|
8529
|
+
|
|
8530
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
8531
|
+
derived from this software without specific prior written permission.
|
|
8532
|
+
|
|
8533
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
8534
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
8535
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
8536
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
8537
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
8538
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
8539
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
8540
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
8541
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
8542
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8543
|
+
*/
|
|
8544
|
+
|
|
8545
|
+
|
|
8436
8546
|
const DEFAULT_THRESHOLD$2 = 1024 * 1024;
|
|
8437
8547
|
const DEFAULT_DIRECTORY_NAME$1 = ".zip.js-temp";
|
|
8438
8548
|
|
|
@@ -8933,6 +9043,7 @@
|
|
|
8933
9043
|
exports.TextWriter = TextWriter;
|
|
8934
9044
|
exports.Uint8ArrayReader = Uint8ArrayReader;
|
|
8935
9045
|
exports.Uint8ArrayWriter = Uint8ArrayWriter;
|
|
9046
|
+
exports.VERSION = VERSION;
|
|
8936
9047
|
exports.WARNING_APPENDED_DATA = WARNING_APPENDED_DATA;
|
|
8937
9048
|
exports.WARNING_COMPRESSED_PATCHED_DATA = WARNING_COMPRESSED_PATCHED_DATA;
|
|
8938
9049
|
exports.WARNING_DUPLICATE_FILENAME = WARNING_DUPLICATE_FILENAME;
|
|
@@ -8957,6 +9068,8 @@
|
|
|
8957
9068
|
exports.createOPFSTempStream = createOPFSTempStream;
|
|
8958
9069
|
exports.createSyncAccessHandleTempStream = createSyncAccessHandleTempStream;
|
|
8959
9070
|
exports.getMimeType = getMimeType;
|
|
9071
|
+
exports.getRegisteredCodecs = getRegisteredCodecs;
|
|
9072
|
+
exports.getSupportedCompressionMethods = getSupportedCompressionMethods;
|
|
8960
9073
|
exports.isZipFile = isZipFile;
|
|
8961
9074
|
exports.registerCodec = registerCodec;
|
|
8962
9075
|
exports.resetConfiguration = resetConfiguration;
|