@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/index-native.cjs
CHANGED
|
@@ -211,6 +211,8 @@ const STRICTNESS_TOLERANT = "tolerant";
|
|
|
211
211
|
const ERR_INVALID_FUNCTION_OPTION = "Invalid option (must be a function)";
|
|
212
212
|
const ERR_INVALID_SIGNAL = "Invalid signal (must be an AbortSignal instance)";
|
|
213
213
|
const ERR_INVALID_PASSWORD_TYPE = "Invalid password (password must be a string, rawPassword must be a Uint8Array)";
|
|
214
|
+
const ERR_ABORTED = "The operation was aborted";
|
|
215
|
+
const ABORT_ERROR_NAME = "AbortError";
|
|
214
216
|
|
|
215
217
|
function checkFunctionOption(value) {
|
|
216
218
|
if (value && typeof value != FUNCTION_TYPE) {
|
|
@@ -226,6 +228,12 @@ function checkSignalOption(signal) {
|
|
|
226
228
|
return signal || UNDEFINED_VALUE;
|
|
227
229
|
}
|
|
228
230
|
|
|
231
|
+
function throwIfAborted(signal) {
|
|
232
|
+
if (signal && signal.aborted) {
|
|
233
|
+
throw signal.reason === UNDEFINED_VALUE ? new DOMException(ERR_ABORTED, ABORT_ERROR_NAME) : signal.reason;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
229
237
|
function checkPasswordOption(password, rawPassword) {
|
|
230
238
|
if ((password && typeof password != STRING_TYPE) || (rawPassword && !(rawPassword instanceof Uint8Array))) {
|
|
231
239
|
throw new Error(ERR_INVALID_PASSWORD_TYPE);
|
|
@@ -3750,11 +3758,13 @@ class BlobReader extends Reader {
|
|
|
3750
3758
|
const reader = this;
|
|
3751
3759
|
const { sourceBlob, size } = reader;
|
|
3752
3760
|
const { offset = 0, size: readSize = size - offset } = options || {};
|
|
3753
|
-
if (
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3761
|
+
if (typeof sourceBlob.stream == FUNCTION_TYPE) {
|
|
3762
|
+
if (!offset && readSize >= size) {
|
|
3763
|
+
return toCompatibleReadable(sourceBlob.stream());
|
|
3764
|
+
}
|
|
3765
|
+
if (blobSliceReliable) {
|
|
3766
|
+
return toCompatibleReadable(sourceBlob.slice(offset, offset + readSize).stream());
|
|
3767
|
+
}
|
|
3758
3768
|
}
|
|
3759
3769
|
return super.createReadable(options);
|
|
3760
3770
|
}
|
|
@@ -5190,27 +5200,28 @@ class ZipReaderStream {
|
|
|
5190
5200
|
const { done, value } = await gen.next();
|
|
5191
5201
|
if (done)
|
|
5192
5202
|
return controller.close();
|
|
5193
|
-
const
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
return readable;
|
|
5200
|
-
}
|
|
5203
|
+
const entryReadable = (function () {
|
|
5204
|
+
const { readable, writable } = new TransformStream();
|
|
5205
|
+
if (value.getData) {
|
|
5206
|
+
getData();
|
|
5207
|
+
return readable;
|
|
5208
|
+
}
|
|
5201
5209
|
|
|
5202
|
-
|
|
5210
|
+
async function getData() {
|
|
5211
|
+
try {
|
|
5212
|
+
await value.getData(writable);
|
|
5213
|
+
} catch (error) {
|
|
5203
5214
|
try {
|
|
5204
|
-
await
|
|
5205
|
-
} catch
|
|
5206
|
-
|
|
5207
|
-
await writable.abort(error);
|
|
5208
|
-
} catch {
|
|
5209
|
-
// ignored
|
|
5210
|
-
}
|
|
5215
|
+
await writable.abort(error);
|
|
5216
|
+
} catch {
|
|
5217
|
+
// ignored
|
|
5211
5218
|
}
|
|
5212
5219
|
}
|
|
5213
|
-
}
|
|
5220
|
+
}
|
|
5221
|
+
})();
|
|
5222
|
+
const chunk = {
|
|
5223
|
+
...value,
|
|
5224
|
+
readable: entryReadable
|
|
5214
5225
|
};
|
|
5215
5226
|
delete chunk.getData;
|
|
5216
5227
|
controller.enqueue(chunk);
|
|
@@ -5356,6 +5367,7 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
5356
5367
|
const size = compressedSize;
|
|
5357
5368
|
const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
|
|
5358
5369
|
const signal = checkSignalOption(getOptionValue$1(zipEntry, options, OPTION_SIGNAL));
|
|
5370
|
+
throwIfAborted(signal);
|
|
5359
5371
|
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5360
5372
|
let checkOverlappingEntry = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY);
|
|
5361
5373
|
const checkOverlappingEntryOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY_ONLY);
|
|
@@ -6886,6 +6898,7 @@ function resolveMetadata(zipWriter, name, options) {
|
|
|
6886
6898
|
const createTempStream = getFunctionOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
6887
6899
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
6888
6900
|
const signal = checkSignalOption(getOptionValue(zipWriter, options, OPTION_SIGNAL));
|
|
6901
|
+
throwIfAborted(signal);
|
|
6889
6902
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
|
|
6890
6903
|
const compressionMethod = getOptionValue(zipWriter, options, PROPERTY_NAME_COMPRESSION_METHOD);
|
|
6891
6904
|
const registeredCodec = passThrough || compressionMethod === UNDEFINED_VALUE ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
@@ -8630,7 +8643,7 @@ function formatSupported(StreamClass, format) {
|
|
|
8630
8643
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8631
8644
|
*/
|
|
8632
8645
|
|
|
8633
|
-
const VERSION = "2.11.
|
|
8646
|
+
const VERSION = "2.11.4";
|
|
8634
8647
|
|
|
8635
8648
|
/*
|
|
8636
8649
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
@@ -9159,8 +9172,6 @@ const ERR_INVALID_PASS_THROUGH = "Invalid passThrough option (use readerOptions.
|
|
|
9159
9172
|
const ERR_INVALID_READER_OPTIONS = "Invalid readerOptions (must be an object)";
|
|
9160
9173
|
const ERR_ZIP_CRYPTO_LAST_MOD_DATE = "The last modification date of an entry encrypted with ZipCrypto cannot be changed when passThrough is set";
|
|
9161
9174
|
const ERR_ABORT_EXPORT = "zipjs-abort-export";
|
|
9162
|
-
const ERR_ABORTED = "The operation was aborted";
|
|
9163
|
-
const ABORT_ERROR_NAME = "AbortError";
|
|
9164
9175
|
const INFOZIP_EXTRA_FIELD_TYPE = "infozip";
|
|
9165
9176
|
const INTERPRETED_EXTRA_FIELD_TYPES = new Set([
|
|
9166
9177
|
EXTRAFIELD_TYPE_ZIP64,
|