@zip.js/zip.js 2.8.54 → 2.8.56
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 +91 -40
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +91 -39
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +103 -52
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +102 -51
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +103 -52
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +105 -53
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +105 -53
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +93 -41
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +93 -41
- package/dist/zip-native.min.js +1 -1
- package/dist/zip-web-worker-native.js +1 -1
- package/dist/zip-web-worker.js +1 -1
- package/dist/zip.js +93 -41
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +105 -53
- package/index-native.min.js +1 -1
- package/index.cjs +105 -53
- package/index.d.cts +29 -7
- package/index.d.ts +29 -7
- package/index.min.js +1 -1
- package/lib/core/constants.js +2 -0
- package/lib/core/options.js +14 -0
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/zip-fs.js +1 -5
- package/lib/core/zip-reader.js +48 -11
- package/lib/core/zip-writer.js +44 -35
- package/lib/core/zlib-streams-inline.js +1 -1
- package/lib/zip-core-writer.js +1 -0
- package/package.json +1 -1
package/index.d.cts
CHANGED
|
@@ -265,6 +265,11 @@ export interface CodecDefinition {
|
|
|
265
265
|
* The URL of a module exporting the `CompressionStream` and/or `DecompressionStream` classes of
|
|
266
266
|
* the codec. Relative URLs are resolved against {@link Configuration#baseURI}; passing an absolute
|
|
267
267
|
* URL (e.g. via `import.meta.resolve()`) is recommended.
|
|
268
|
+
*
|
|
269
|
+
* @remarks
|
|
270
|
+
* The module is imported dynamically at runtime. Bundlers and single-file builds (e.g.
|
|
271
|
+
* `deno compile`) cannot follow this import, so the module must be included explicitly
|
|
272
|
+
* (e.g. with `deno compile --include` or the equivalent option of the bundler).
|
|
268
273
|
*/
|
|
269
274
|
codecURI?: string;
|
|
270
275
|
/**
|
|
@@ -1195,6 +1200,11 @@ export class Uint8ArrayWriter extends Writer<Uint8Array<ArrayBuffer>> {
|
|
|
1195
1200
|
/**
|
|
1196
1201
|
* Represents an instance used to create an unzipped stream.
|
|
1197
1202
|
*
|
|
1203
|
+
* @remarks
|
|
1204
|
+
* The input is entirely read into a `Blob` before the first entry is emitted, because a zip file stores its
|
|
1205
|
+
* central directory at the end. This class is a convenience wrapper around {@link ZipReader} for stream
|
|
1206
|
+
* sources, it does not extract entries while the data is still arriving.
|
|
1207
|
+
*
|
|
1198
1208
|
* @example
|
|
1199
1209
|
* This example will take a zip file, decompress it and then save its files and directories to disk.
|
|
1200
1210
|
* ```
|
|
@@ -1304,9 +1314,13 @@ export class ZipReader<Type> {
|
|
|
1304
1314
|
appendedData?: Uint8Array;
|
|
1305
1315
|
/**
|
|
1306
1316
|
* The data of the digital signature record of the central directory (see
|
|
1307
|
-
* {@link ZipWriterCloseOptions#signCentralDirectory}), if the zip file contains one.
|
|
1308
|
-
*
|
|
1309
|
-
*
|
|
1317
|
+
* {@link ZipWriterCloseOptions#signCentralDirectory}), if the zip file contains one.
|
|
1318
|
+
*
|
|
1319
|
+
* @remarks
|
|
1320
|
+
* zip.js does not verify signatures. The signed data is the central directory records, read at
|
|
1321
|
+
* {@link ZipReader#directoryOffset}, and it never includes the digital signature record itself. Some writers
|
|
1322
|
+
* (e.g. SecureZIP) store that record inside {@link ZipReader#directoryLength}, so verifying the whole declared
|
|
1323
|
+
* range would always fail.
|
|
1310
1324
|
*/
|
|
1311
1325
|
digitalSignature?: Uint8Array;
|
|
1312
1326
|
/**
|
|
@@ -1314,7 +1328,9 @@ export class ZipReader<Type> {
|
|
|
1314
1328
|
*/
|
|
1315
1329
|
directoryOffset?: number;
|
|
1316
1330
|
/**
|
|
1317
|
-
* The length in bytes of the central directory as declared in the end of central directory record.
|
|
1331
|
+
* The length in bytes of the central directory as declared in the end of central directory record. Some
|
|
1332
|
+
* writers (e.g. SecureZIP) include the digital signature record in that length, so subtract
|
|
1333
|
+
* `6 + digitalSignature.length` from it when the record is stored inside the declared range.
|
|
1318
1334
|
*/
|
|
1319
1335
|
directoryLength?: number;
|
|
1320
1336
|
/**
|
|
@@ -3079,9 +3095,11 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
|
|
|
3079
3095
|
* `true` to write the data as-is without compressing it and without crypting it.
|
|
3080
3096
|
*
|
|
3081
3097
|
* @remarks
|
|
3082
|
-
* The {@link ZipWriterConstructorOptions#level}
|
|
3083
|
-
*
|
|
3084
|
-
*
|
|
3098
|
+
* The data is never compressed, so the {@link ZipWriterConstructorOptions#level} option does not apply and is
|
|
3099
|
+
* ignored. The {@link ZipWriterAddDataOptions#compressionMethod} option selects no codec either, it declares
|
|
3100
|
+
* how the data is already compressed and is written as-is in the entry headers. It must be set, otherwise an
|
|
3101
|
+
* {@link ERR_UNDEFINED_COMPRESSION_METHOD} error is thrown. The entries with no content, e.g. the
|
|
3102
|
+
* directories, ignore this option entirely. Setting the {@link ZipWriterConstructorOptions#password} or the
|
|
3085
3103
|
* {@link ZipWriterConstructorOptions#rawPassword} option throws an
|
|
3086
3104
|
* {@link ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH} error, unless the
|
|
3087
3105
|
* {@link ZipWriterConstructorOptions#encrypted} option is set to `true` to declare that the data is already
|
|
@@ -4310,6 +4328,10 @@ export const ERR_ITERATOR_COMPLETED_TOO_SOON: string;
|
|
|
4310
4328
|
* Undefined uncompressed size error
|
|
4311
4329
|
*/
|
|
4312
4330
|
export const ERR_UNDEFINED_UNCOMPRESSED_SIZE: string;
|
|
4331
|
+
/**
|
|
4332
|
+
* Undefined compression method error
|
|
4333
|
+
*/
|
|
4334
|
+
export const ERR_UNDEFINED_COMPRESSION_METHOD: string;
|
|
4313
4335
|
export const ERR_UNDETERMINED_SIZE: string;
|
|
4314
4336
|
/**
|
|
4315
4337
|
* Undefined reader error
|
package/index.d.ts
CHANGED
|
@@ -265,6 +265,11 @@ export interface CodecDefinition {
|
|
|
265
265
|
* The URL of a module exporting the `CompressionStream` and/or `DecompressionStream` classes of
|
|
266
266
|
* the codec. Relative URLs are resolved against {@link Configuration#baseURI}; passing an absolute
|
|
267
267
|
* URL (e.g. via `import.meta.resolve()`) is recommended.
|
|
268
|
+
*
|
|
269
|
+
* @remarks
|
|
270
|
+
* The module is imported dynamically at runtime. Bundlers and single-file builds (e.g.
|
|
271
|
+
* `deno compile`) cannot follow this import, so the module must be included explicitly
|
|
272
|
+
* (e.g. with `deno compile --include` or the equivalent option of the bundler).
|
|
268
273
|
*/
|
|
269
274
|
codecURI?: string;
|
|
270
275
|
/**
|
|
@@ -1195,6 +1200,11 @@ export class Uint8ArrayWriter extends Writer<Uint8Array<ArrayBuffer>> {
|
|
|
1195
1200
|
/**
|
|
1196
1201
|
* Represents an instance used to create an unzipped stream.
|
|
1197
1202
|
*
|
|
1203
|
+
* @remarks
|
|
1204
|
+
* The input is entirely read into a `Blob` before the first entry is emitted, because a zip file stores its
|
|
1205
|
+
* central directory at the end. This class is a convenience wrapper around {@link ZipReader} for stream
|
|
1206
|
+
* sources, it does not extract entries while the data is still arriving.
|
|
1207
|
+
*
|
|
1198
1208
|
* @example
|
|
1199
1209
|
* This example will take a zip file, decompress it and then save its files and directories to disk.
|
|
1200
1210
|
* ```
|
|
@@ -1304,9 +1314,13 @@ export class ZipReader<Type> {
|
|
|
1304
1314
|
appendedData?: Uint8Array;
|
|
1305
1315
|
/**
|
|
1306
1316
|
* The data of the digital signature record of the central directory (see
|
|
1307
|
-
* {@link ZipWriterCloseOptions#signCentralDirectory}), if the zip file contains one.
|
|
1308
|
-
*
|
|
1309
|
-
*
|
|
1317
|
+
* {@link ZipWriterCloseOptions#signCentralDirectory}), if the zip file contains one.
|
|
1318
|
+
*
|
|
1319
|
+
* @remarks
|
|
1320
|
+
* zip.js does not verify signatures. The signed data is the central directory records, read at
|
|
1321
|
+
* {@link ZipReader#directoryOffset}, and it never includes the digital signature record itself. Some writers
|
|
1322
|
+
* (e.g. SecureZIP) store that record inside {@link ZipReader#directoryLength}, so verifying the whole declared
|
|
1323
|
+
* range would always fail.
|
|
1310
1324
|
*/
|
|
1311
1325
|
digitalSignature?: Uint8Array;
|
|
1312
1326
|
/**
|
|
@@ -1314,7 +1328,9 @@ export class ZipReader<Type> {
|
|
|
1314
1328
|
*/
|
|
1315
1329
|
directoryOffset?: number;
|
|
1316
1330
|
/**
|
|
1317
|
-
* The length in bytes of the central directory as declared in the end of central directory record.
|
|
1331
|
+
* The length in bytes of the central directory as declared in the end of central directory record. Some
|
|
1332
|
+
* writers (e.g. SecureZIP) include the digital signature record in that length, so subtract
|
|
1333
|
+
* `6 + digitalSignature.length` from it when the record is stored inside the declared range.
|
|
1318
1334
|
*/
|
|
1319
1335
|
directoryLength?: number;
|
|
1320
1336
|
/**
|
|
@@ -3079,9 +3095,11 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
|
|
|
3079
3095
|
* `true` to write the data as-is without compressing it and without crypting it.
|
|
3080
3096
|
*
|
|
3081
3097
|
* @remarks
|
|
3082
|
-
* The {@link ZipWriterConstructorOptions#level}
|
|
3083
|
-
*
|
|
3084
|
-
*
|
|
3098
|
+
* The data is never compressed, so the {@link ZipWriterConstructorOptions#level} option does not apply and is
|
|
3099
|
+
* ignored. The {@link ZipWriterAddDataOptions#compressionMethod} option selects no codec either, it declares
|
|
3100
|
+
* how the data is already compressed and is written as-is in the entry headers. It must be set, otherwise an
|
|
3101
|
+
* {@link ERR_UNDEFINED_COMPRESSION_METHOD} error is thrown. The entries with no content, e.g. the
|
|
3102
|
+
* directories, ignore this option entirely. Setting the {@link ZipWriterConstructorOptions#password} or the
|
|
3085
3103
|
* {@link ZipWriterConstructorOptions#rawPassword} option throws an
|
|
3086
3104
|
* {@link ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH} error, unless the
|
|
3087
3105
|
* {@link ZipWriterConstructorOptions#encrypted} option is set to `true` to declare that the data is already
|
|
@@ -4310,6 +4328,10 @@ export const ERR_ITERATOR_COMPLETED_TOO_SOON: string;
|
|
|
4310
4328
|
* Undefined uncompressed size error
|
|
4311
4329
|
*/
|
|
4312
4330
|
export const ERR_UNDEFINED_UNCOMPRESSED_SIZE: string;
|
|
4331
|
+
/**
|
|
4332
|
+
* Undefined compression method error
|
|
4333
|
+
*/
|
|
4334
|
+
export const ERR_UNDEFINED_COMPRESSION_METHOD: string;
|
|
4313
4335
|
export const ERR_UNDETERMINED_SIZE: string;
|
|
4314
4336
|
/**
|
|
4315
4337
|
* Undefined reader error
|