@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.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
|
}
|
|
@@ -5180,27 +5190,28 @@
|
|
|
5180
5190
|
const { done, value } = await gen.next();
|
|
5181
5191
|
if (done)
|
|
5182
5192
|
return controller.close();
|
|
5183
|
-
const
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
return readable;
|
|
5190
|
-
}
|
|
5193
|
+
const entryReadable = (function () {
|
|
5194
|
+
const { readable, writable } = new TransformStream();
|
|
5195
|
+
if (value.getData) {
|
|
5196
|
+
getData();
|
|
5197
|
+
return readable;
|
|
5198
|
+
}
|
|
5191
5199
|
|
|
5192
|
-
|
|
5200
|
+
async function getData() {
|
|
5201
|
+
try {
|
|
5202
|
+
await value.getData(writable);
|
|
5203
|
+
} catch (error) {
|
|
5193
5204
|
try {
|
|
5194
|
-
await
|
|
5195
|
-
} catch
|
|
5196
|
-
|
|
5197
|
-
await writable.abort(error);
|
|
5198
|
-
} catch {
|
|
5199
|
-
// ignored
|
|
5200
|
-
}
|
|
5205
|
+
await writable.abort(error);
|
|
5206
|
+
} catch {
|
|
5207
|
+
// ignored
|
|
5201
5208
|
}
|
|
5202
5209
|
}
|
|
5203
|
-
}
|
|
5210
|
+
}
|
|
5211
|
+
})();
|
|
5212
|
+
const chunk = {
|
|
5213
|
+
...value,
|
|
5214
|
+
readable: entryReadable
|
|
5204
5215
|
};
|
|
5205
5216
|
delete chunk.getData;
|
|
5206
5217
|
controller.enqueue(chunk);
|
|
@@ -5346,6 +5357,7 @@
|
|
|
5346
5357
|
const size = compressedSize;
|
|
5347
5358
|
const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
|
|
5348
5359
|
const signal = checkSignalOption(getOptionValue$1(zipEntry, options, OPTION_SIGNAL));
|
|
5360
|
+
throwIfAborted(signal);
|
|
5349
5361
|
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5350
5362
|
let checkOverlappingEntry = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY);
|
|
5351
5363
|
const checkOverlappingEntryOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY_ONLY);
|
|
@@ -6876,6 +6888,7 @@
|
|
|
6876
6888
|
const createTempStream = getFunctionOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
6877
6889
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
6878
6890
|
const signal = checkSignalOption(getOptionValue(zipWriter, options, OPTION_SIGNAL));
|
|
6891
|
+
throwIfAborted(signal);
|
|
6879
6892
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
|
|
6880
6893
|
const compressionMethod = getOptionValue(zipWriter, options, PROPERTY_NAME_COMPRESSION_METHOD);
|
|
6881
6894
|
const registeredCodec = passThrough || compressionMethod === UNDEFINED_VALUE ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
@@ -8543,7 +8556,7 @@
|
|
|
8543
8556
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8544
8557
|
*/
|
|
8545
8558
|
|
|
8546
|
-
const VERSION = "2.11.
|
|
8559
|
+
const VERSION = "2.11.4";
|
|
8547
8560
|
|
|
8548
8561
|
/*
|
|
8549
8562
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|