@zip.js/zip.js 2.11.3 → 2.11.4
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 +1 -1
- package/dist/zip-core-external.js +36 -23
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +36 -23
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +36 -25
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +36 -25
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +36 -25
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +36 -25
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +36 -25
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +36 -23
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +36 -23
- package/dist/zip-native.min.js +1 -1
- package/dist/zip.js +36 -23
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +36 -25
- package/index-native.min.js +1 -1
- package/index.cjs +36 -25
- package/index.d.cts +12 -0
- package/index.d.ts +12 -0
- package/index.min.js +1 -1
- package/lib/core/io.js +7 -5
- package/lib/core/options.js +13 -0
- package/lib/core/version.js +1 -1
- package/lib/core/zip-fs.js +1 -3
- package/lib/core/zip-reader.js +20 -17
- package/lib/core/zip-writer.js +2 -0
- package/package.json +1 -1
package/dist/zip-fs.js
CHANGED
|
@@ -217,6 +217,8 @@
|
|
|
217
217
|
const ERR_INVALID_FUNCTION_OPTION = "Invalid option (must be a function)";
|
|
218
218
|
const ERR_INVALID_SIGNAL = "Invalid signal (must be an AbortSignal instance)";
|
|
219
219
|
const ERR_INVALID_PASSWORD_TYPE = "Invalid password (password must be a string, rawPassword must be a Uint8Array)";
|
|
220
|
+
const ERR_ABORTED = "The operation was aborted";
|
|
221
|
+
const ABORT_ERROR_NAME = "AbortError";
|
|
220
222
|
|
|
221
223
|
function checkFunctionOption(value) {
|
|
222
224
|
if (value && typeof value != FUNCTION_TYPE) {
|
|
@@ -232,6 +234,12 @@
|
|
|
232
234
|
return signal || UNDEFINED_VALUE;
|
|
233
235
|
}
|
|
234
236
|
|
|
237
|
+
function throwIfAborted(signal) {
|
|
238
|
+
if (signal && signal.aborted) {
|
|
239
|
+
throw signal.reason === UNDEFINED_VALUE ? new DOMException(ERR_ABORTED, ABORT_ERROR_NAME) : signal.reason;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
235
243
|
function checkPasswordOption(password, rawPassword) {
|
|
236
244
|
if ((password && typeof password != STRING_TYPE) || (rawPassword && !(rawPassword instanceof Uint8Array))) {
|
|
237
245
|
throw new Error(ERR_INVALID_PASSWORD_TYPE);
|
|
@@ -3760,11 +3768,13 @@
|
|
|
3760
3768
|
const reader = this;
|
|
3761
3769
|
const { sourceBlob, size } = reader;
|
|
3762
3770
|
const { offset = 0, size: readSize = size - offset } = options || {};
|
|
3763
|
-
if (
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3771
|
+
if (typeof sourceBlob.stream == FUNCTION_TYPE) {
|
|
3772
|
+
if (!offset && readSize >= size) {
|
|
3773
|
+
return toCompatibleReadable(sourceBlob.stream());
|
|
3774
|
+
}
|
|
3775
|
+
if (blobSliceReliable) {
|
|
3776
|
+
return toCompatibleReadable(sourceBlob.slice(offset, offset + readSize).stream());
|
|
3777
|
+
}
|
|
3768
3778
|
}
|
|
3769
3779
|
return super.createReadable(options);
|
|
3770
3780
|
}
|
|
@@ -5200,27 +5210,28 @@
|
|
|
5200
5210
|
const { done, value } = await gen.next();
|
|
5201
5211
|
if (done)
|
|
5202
5212
|
return controller.close();
|
|
5203
|
-
const
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
return readable;
|
|
5210
|
-
}
|
|
5213
|
+
const entryReadable = (function () {
|
|
5214
|
+
const { readable, writable } = new TransformStream();
|
|
5215
|
+
if (value.getData) {
|
|
5216
|
+
getData();
|
|
5217
|
+
return readable;
|
|
5218
|
+
}
|
|
5211
5219
|
|
|
5212
|
-
|
|
5220
|
+
async function getData() {
|
|
5221
|
+
try {
|
|
5222
|
+
await value.getData(writable);
|
|
5223
|
+
} catch (error) {
|
|
5213
5224
|
try {
|
|
5214
|
-
await
|
|
5215
|
-
} catch
|
|
5216
|
-
|
|
5217
|
-
await writable.abort(error);
|
|
5218
|
-
} catch {
|
|
5219
|
-
// ignored
|
|
5220
|
-
}
|
|
5225
|
+
await writable.abort(error);
|
|
5226
|
+
} catch {
|
|
5227
|
+
// ignored
|
|
5221
5228
|
}
|
|
5222
5229
|
}
|
|
5223
|
-
}
|
|
5230
|
+
}
|
|
5231
|
+
})();
|
|
5232
|
+
const chunk = {
|
|
5233
|
+
...value,
|
|
5234
|
+
readable: entryReadable
|
|
5224
5235
|
};
|
|
5225
5236
|
delete chunk.getData;
|
|
5226
5237
|
controller.enqueue(chunk);
|
|
@@ -5366,6 +5377,7 @@
|
|
|
5366
5377
|
const size = compressedSize;
|
|
5367
5378
|
const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
|
|
5368
5379
|
const signal = checkSignalOption(getOptionValue$1(zipEntry, options, OPTION_SIGNAL));
|
|
5380
|
+
throwIfAborted(signal);
|
|
5369
5381
|
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5370
5382
|
let checkOverlappingEntry = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY);
|
|
5371
5383
|
const checkOverlappingEntryOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY_ONLY);
|
|
@@ -6896,6 +6908,7 @@
|
|
|
6896
6908
|
const createTempStream = getFunctionOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
6897
6909
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
6898
6910
|
const signal = checkSignalOption(getOptionValue(zipWriter, options, OPTION_SIGNAL));
|
|
6911
|
+
throwIfAborted(signal);
|
|
6899
6912
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
|
|
6900
6913
|
const compressionMethod = getOptionValue(zipWriter, options, PROPERTY_NAME_COMPRESSION_METHOD);
|
|
6901
6914
|
const registeredCodec = passThrough || compressionMethod === UNDEFINED_VALUE ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
@@ -8640,7 +8653,7 @@
|
|
|
8640
8653
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8641
8654
|
*/
|
|
8642
8655
|
|
|
8643
|
-
const VERSION = "2.11.
|
|
8656
|
+
const VERSION = "2.11.4";
|
|
8644
8657
|
|
|
8645
8658
|
/*
|
|
8646
8659
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
@@ -9541,8 +9554,6 @@
|
|
|
9541
9554
|
const ERR_INVALID_READER_OPTIONS = "Invalid readerOptions (must be an object)";
|
|
9542
9555
|
const ERR_ZIP_CRYPTO_LAST_MOD_DATE = "The last modification date of an entry encrypted with ZipCrypto cannot be changed when passThrough is set";
|
|
9543
9556
|
const ERR_ABORT_EXPORT = "zipjs-abort-export";
|
|
9544
|
-
const ERR_ABORTED = "The operation was aborted";
|
|
9545
|
-
const ABORT_ERROR_NAME = "AbortError";
|
|
9546
9557
|
const INFOZIP_EXTRA_FIELD_TYPE = "infozip";
|
|
9547
9558
|
const INTERPRETED_EXTRA_FIELD_TYPES = new Set([
|
|
9548
9559
|
EXTRAFIELD_TYPE_ZIP64,
|