@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/deno.json
CHANGED
|
@@ -208,6 +208,8 @@ const STRICTNESS_TOLERANT = "tolerant";
|
|
|
208
208
|
const ERR_INVALID_FUNCTION_OPTION = "Invalid option (must be a function)";
|
|
209
209
|
const ERR_INVALID_SIGNAL = "Invalid signal (must be an AbortSignal instance)";
|
|
210
210
|
const ERR_INVALID_PASSWORD_TYPE = "Invalid password (password must be a string, rawPassword must be a Uint8Array)";
|
|
211
|
+
const ERR_ABORTED = "The operation was aborted";
|
|
212
|
+
const ABORT_ERROR_NAME = "AbortError";
|
|
211
213
|
|
|
212
214
|
function checkFunctionOption(value) {
|
|
213
215
|
if (value && typeof value != FUNCTION_TYPE) {
|
|
@@ -223,6 +225,12 @@ function checkSignalOption(signal) {
|
|
|
223
225
|
return signal || UNDEFINED_VALUE;
|
|
224
226
|
}
|
|
225
227
|
|
|
228
|
+
function throwIfAborted(signal) {
|
|
229
|
+
if (signal && signal.aborted) {
|
|
230
|
+
throw signal.reason === UNDEFINED_VALUE ? new DOMException(ERR_ABORTED, ABORT_ERROR_NAME) : signal.reason;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
226
234
|
function checkPasswordOption(password, rawPassword) {
|
|
227
235
|
if ((password && typeof password != STRING_TYPE) || (rawPassword && !(rawPassword instanceof Uint8Array))) {
|
|
228
236
|
throw new Error(ERR_INVALID_PASSWORD_TYPE);
|
|
@@ -3785,11 +3793,13 @@ class BlobReader extends Reader {
|
|
|
3785
3793
|
const reader = this;
|
|
3786
3794
|
const { sourceBlob, size } = reader;
|
|
3787
3795
|
const { offset = 0, size: readSize = size - offset } = options || {};
|
|
3788
|
-
if (
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3796
|
+
if (typeof sourceBlob.stream == FUNCTION_TYPE) {
|
|
3797
|
+
if (!offset && readSize >= size) {
|
|
3798
|
+
return toCompatibleReadable(sourceBlob.stream());
|
|
3799
|
+
}
|
|
3800
|
+
if (blobSliceReliable) {
|
|
3801
|
+
return toCompatibleReadable(sourceBlob.slice(offset, offset + readSize).stream());
|
|
3802
|
+
}
|
|
3793
3803
|
}
|
|
3794
3804
|
return super.createReadable(options);
|
|
3795
3805
|
}
|
|
@@ -5205,27 +5215,28 @@ class ZipReaderStream {
|
|
|
5205
5215
|
const { done, value } = await gen.next();
|
|
5206
5216
|
if (done)
|
|
5207
5217
|
return controller.close();
|
|
5208
|
-
const
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
return readable;
|
|
5215
|
-
}
|
|
5218
|
+
const entryReadable = (function () {
|
|
5219
|
+
const { readable, writable } = new TransformStream();
|
|
5220
|
+
if (value.getData) {
|
|
5221
|
+
getData();
|
|
5222
|
+
return readable;
|
|
5223
|
+
}
|
|
5216
5224
|
|
|
5217
|
-
|
|
5225
|
+
async function getData() {
|
|
5226
|
+
try {
|
|
5227
|
+
await value.getData(writable);
|
|
5228
|
+
} catch (error) {
|
|
5218
5229
|
try {
|
|
5219
|
-
await
|
|
5220
|
-
} catch
|
|
5221
|
-
|
|
5222
|
-
await writable.abort(error);
|
|
5223
|
-
} catch {
|
|
5224
|
-
// ignored
|
|
5225
|
-
}
|
|
5230
|
+
await writable.abort(error);
|
|
5231
|
+
} catch {
|
|
5232
|
+
// ignored
|
|
5226
5233
|
}
|
|
5227
5234
|
}
|
|
5228
|
-
}
|
|
5235
|
+
}
|
|
5236
|
+
})();
|
|
5237
|
+
const chunk = {
|
|
5238
|
+
...value,
|
|
5239
|
+
readable: entryReadable
|
|
5229
5240
|
};
|
|
5230
5241
|
delete chunk.getData;
|
|
5231
5242
|
controller.enqueue(chunk);
|
|
@@ -5371,6 +5382,7 @@ class ZipEntry {
|
|
|
5371
5382
|
const size = compressedSize;
|
|
5372
5383
|
const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
|
|
5373
5384
|
const signal = checkSignalOption(getOptionValue$1(zipEntry, options, OPTION_SIGNAL));
|
|
5385
|
+
throwIfAborted(signal);
|
|
5374
5386
|
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5375
5387
|
let checkOverlappingEntry = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY);
|
|
5376
5388
|
const checkOverlappingEntryOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY_ONLY);
|
|
@@ -6901,6 +6913,7 @@ function resolveMetadata(zipWriter, name, options) {
|
|
|
6901
6913
|
const createTempStream = getFunctionOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
6902
6914
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
6903
6915
|
const signal = checkSignalOption(getOptionValue(zipWriter, options, OPTION_SIGNAL));
|
|
6916
|
+
throwIfAborted(signal);
|
|
6904
6917
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
|
|
6905
6918
|
const compressionMethod = getOptionValue(zipWriter, options, PROPERTY_NAME_COMPRESSION_METHOD);
|
|
6906
6919
|
const registeredCodec = passThrough || compressionMethod === UNDEFINED_VALUE ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
@@ -8568,7 +8581,7 @@ function formatSupported(StreamClass, format) {
|
|
|
8568
8581
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8569
8582
|
*/
|
|
8570
8583
|
|
|
8571
|
-
const VERSION = "2.11.
|
|
8584
|
+
const VERSION = "2.11.4";
|
|
8572
8585
|
|
|
8573
8586
|
/*
|
|
8574
8587
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|