@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-core.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);
|
|
@@ -3754,11 +3762,13 @@
|
|
|
3754
3762
|
const reader = this;
|
|
3755
3763
|
const { sourceBlob, size } = reader;
|
|
3756
3764
|
const { offset = 0, size: readSize = size - offset } = options || {};
|
|
3757
|
-
if (
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3765
|
+
if (typeof sourceBlob.stream == FUNCTION_TYPE) {
|
|
3766
|
+
if (!offset && readSize >= size) {
|
|
3767
|
+
return toCompatibleReadable(sourceBlob.stream());
|
|
3768
|
+
}
|
|
3769
|
+
if (blobSliceReliable) {
|
|
3770
|
+
return toCompatibleReadable(sourceBlob.slice(offset, offset + readSize).stream());
|
|
3771
|
+
}
|
|
3762
3772
|
}
|
|
3763
3773
|
return super.createReadable(options);
|
|
3764
3774
|
}
|
|
@@ -5194,27 +5204,28 @@
|
|
|
5194
5204
|
const { done, value } = await gen.next();
|
|
5195
5205
|
if (done)
|
|
5196
5206
|
return controller.close();
|
|
5197
|
-
const
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
return readable;
|
|
5204
|
-
}
|
|
5207
|
+
const entryReadable = (function () {
|
|
5208
|
+
const { readable, writable } = new TransformStream();
|
|
5209
|
+
if (value.getData) {
|
|
5210
|
+
getData();
|
|
5211
|
+
return readable;
|
|
5212
|
+
}
|
|
5205
5213
|
|
|
5206
|
-
|
|
5214
|
+
async function getData() {
|
|
5215
|
+
try {
|
|
5216
|
+
await value.getData(writable);
|
|
5217
|
+
} catch (error) {
|
|
5207
5218
|
try {
|
|
5208
|
-
await
|
|
5209
|
-
} catch
|
|
5210
|
-
|
|
5211
|
-
await writable.abort(error);
|
|
5212
|
-
} catch {
|
|
5213
|
-
// ignored
|
|
5214
|
-
}
|
|
5219
|
+
await writable.abort(error);
|
|
5220
|
+
} catch {
|
|
5221
|
+
// ignored
|
|
5215
5222
|
}
|
|
5216
5223
|
}
|
|
5217
|
-
}
|
|
5224
|
+
}
|
|
5225
|
+
})();
|
|
5226
|
+
const chunk = {
|
|
5227
|
+
...value,
|
|
5228
|
+
readable: entryReadable
|
|
5218
5229
|
};
|
|
5219
5230
|
delete chunk.getData;
|
|
5220
5231
|
controller.enqueue(chunk);
|
|
@@ -5360,6 +5371,7 @@
|
|
|
5360
5371
|
const size = compressedSize;
|
|
5361
5372
|
const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
|
|
5362
5373
|
const signal = checkSignalOption(getOptionValue$1(zipEntry, options, OPTION_SIGNAL));
|
|
5374
|
+
throwIfAborted(signal);
|
|
5363
5375
|
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5364
5376
|
let checkOverlappingEntry = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY);
|
|
5365
5377
|
const checkOverlappingEntryOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY_ONLY);
|
|
@@ -6890,6 +6902,7 @@
|
|
|
6890
6902
|
const createTempStream = getFunctionOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
6891
6903
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
6892
6904
|
const signal = checkSignalOption(getOptionValue(zipWriter, options, OPTION_SIGNAL));
|
|
6905
|
+
throwIfAborted(signal);
|
|
6893
6906
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
|
|
6894
6907
|
const compressionMethod = getOptionValue(zipWriter, options, PROPERTY_NAME_COMPRESSION_METHOD);
|
|
6895
6908
|
const registeredCodec = passThrough || compressionMethod === UNDEFINED_VALUE ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
@@ -8634,7 +8647,7 @@
|
|
|
8634
8647
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8635
8648
|
*/
|
|
8636
8649
|
|
|
8637
|
-
const VERSION = "2.11.
|
|
8650
|
+
const VERSION = "2.11.4";
|
|
8638
8651
|
|
|
8639
8652
|
/*
|
|
8640
8653
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
@@ -9125,8 +9138,6 @@
|
|
|
9125
9138
|
const ERR_INVALID_READER_OPTIONS = "Invalid readerOptions (must be an object)";
|
|
9126
9139
|
const ERR_ZIP_CRYPTO_LAST_MOD_DATE = "The last modification date of an entry encrypted with ZipCrypto cannot be changed when passThrough is set";
|
|
9127
9140
|
const ERR_ABORT_EXPORT = "zipjs-abort-export";
|
|
9128
|
-
const ERR_ABORTED = "The operation was aborted";
|
|
9129
|
-
const ABORT_ERROR_NAME = "AbortError";
|
|
9130
9141
|
const INFOZIP_EXTRA_FIELD_TYPE = "infozip";
|
|
9131
9142
|
const INTERPRETED_EXTRA_FIELD_TYPES = new Set([
|
|
9132
9143
|
EXTRAFIELD_TYPE_ZIP64,
|