@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-native.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);
|
|
@@ -3756,11 +3764,13 @@
|
|
|
3756
3764
|
const reader = this;
|
|
3757
3765
|
const { sourceBlob, size } = reader;
|
|
3758
3766
|
const { offset = 0, size: readSize = size - offset } = options || {};
|
|
3759
|
-
if (
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3767
|
+
if (typeof sourceBlob.stream == FUNCTION_TYPE) {
|
|
3768
|
+
if (!offset && readSize >= size) {
|
|
3769
|
+
return toCompatibleReadable(sourceBlob.stream());
|
|
3770
|
+
}
|
|
3771
|
+
if (blobSliceReliable) {
|
|
3772
|
+
return toCompatibleReadable(sourceBlob.slice(offset, offset + readSize).stream());
|
|
3773
|
+
}
|
|
3764
3774
|
}
|
|
3765
3775
|
return super.createReadable(options);
|
|
3766
3776
|
}
|
|
@@ -5196,27 +5206,28 @@
|
|
|
5196
5206
|
const { done, value } = await gen.next();
|
|
5197
5207
|
if (done)
|
|
5198
5208
|
return controller.close();
|
|
5199
|
-
const
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
return readable;
|
|
5206
|
-
}
|
|
5209
|
+
const entryReadable = (function () {
|
|
5210
|
+
const { readable, writable } = new TransformStream();
|
|
5211
|
+
if (value.getData) {
|
|
5212
|
+
getData();
|
|
5213
|
+
return readable;
|
|
5214
|
+
}
|
|
5207
5215
|
|
|
5208
|
-
|
|
5216
|
+
async function getData() {
|
|
5217
|
+
try {
|
|
5218
|
+
await value.getData(writable);
|
|
5219
|
+
} catch (error) {
|
|
5209
5220
|
try {
|
|
5210
|
-
await
|
|
5211
|
-
} catch
|
|
5212
|
-
|
|
5213
|
-
await writable.abort(error);
|
|
5214
|
-
} catch {
|
|
5215
|
-
// ignored
|
|
5216
|
-
}
|
|
5221
|
+
await writable.abort(error);
|
|
5222
|
+
} catch {
|
|
5223
|
+
// ignored
|
|
5217
5224
|
}
|
|
5218
5225
|
}
|
|
5219
|
-
}
|
|
5226
|
+
}
|
|
5227
|
+
})();
|
|
5228
|
+
const chunk = {
|
|
5229
|
+
...value,
|
|
5230
|
+
readable: entryReadable
|
|
5220
5231
|
};
|
|
5221
5232
|
delete chunk.getData;
|
|
5222
5233
|
controller.enqueue(chunk);
|
|
@@ -5362,6 +5373,7 @@
|
|
|
5362
5373
|
const size = compressedSize;
|
|
5363
5374
|
const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
|
|
5364
5375
|
const signal = checkSignalOption(getOptionValue$1(zipEntry, options, OPTION_SIGNAL));
|
|
5376
|
+
throwIfAborted(signal);
|
|
5365
5377
|
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5366
5378
|
let checkOverlappingEntry = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY);
|
|
5367
5379
|
const checkOverlappingEntryOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY_ONLY);
|
|
@@ -6892,6 +6904,7 @@
|
|
|
6892
6904
|
const createTempStream = getFunctionOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
6893
6905
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
6894
6906
|
const signal = checkSignalOption(getOptionValue(zipWriter, options, OPTION_SIGNAL));
|
|
6907
|
+
throwIfAborted(signal);
|
|
6895
6908
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
|
|
6896
6909
|
const compressionMethod = getOptionValue(zipWriter, options, PROPERTY_NAME_COMPRESSION_METHOD);
|
|
6897
6910
|
const registeredCodec = passThrough || compressionMethod === UNDEFINED_VALUE ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
@@ -8636,7 +8649,7 @@
|
|
|
8636
8649
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8637
8650
|
*/
|
|
8638
8651
|
|
|
8639
|
-
const VERSION = "2.11.
|
|
8652
|
+
const VERSION = "2.11.4";
|
|
8640
8653
|
|
|
8641
8654
|
/*
|
|
8642
8655
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
@@ -9165,8 +9178,6 @@
|
|
|
9165
9178
|
const ERR_INVALID_READER_OPTIONS = "Invalid readerOptions (must be an object)";
|
|
9166
9179
|
const ERR_ZIP_CRYPTO_LAST_MOD_DATE = "The last modification date of an entry encrypted with ZipCrypto cannot be changed when passThrough is set";
|
|
9167
9180
|
const ERR_ABORT_EXPORT = "zipjs-abort-export";
|
|
9168
|
-
const ERR_ABORTED = "The operation was aborted";
|
|
9169
|
-
const ABORT_ERROR_NAME = "AbortError";
|
|
9170
9181
|
const INFOZIP_EXTRA_FIELD_TYPE = "infozip";
|
|
9171
9182
|
const INTERPRETED_EXTRA_FIELD_TYPES = new Set([
|
|
9172
9183
|
EXTRAFIELD_TYPE_ZIP64,
|