@zip.js/zip.js 2.8.34 → 2.8.35
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/README.md +13 -1
- package/deno.json +5 -2
- package/dist/README.md +3 -1
- package/dist/zip-core.js +472 -220
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core.js +449 -220
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-native.js +476 -226
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +478 -228
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +474 -222
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +475 -223
- 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 +477 -225
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +476 -226
- package/index-native.min.js +1 -1
- package/index.cjs +478 -228
- package/index.d.cts +53 -0
- package/index.d.ts +53 -0
- package/index.min.js +1 -1
- package/lib/core/codec-pool.js +2 -2
- package/lib/core/codec-worker.js +6 -2
- package/lib/core/configuration.js +22 -1
- package/lib/core/io.js +209 -56
- package/lib/core/streams/aes-crypto-stream.js +1 -10
- package/lib/core/streams/codec-stream.js +36 -15
- package/lib/core/streams/zip-entry-stream.js +19 -28
- package/lib/core/util/array.js +48 -0
- package/lib/core/web-worker-base.js +3 -3
- 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 +2 -3
- package/lib/core/zip-reader.js +37 -40
- package/lib/core/zip-writer.js +58 -51
- package/lib/core/zlib-streams-inline.js +1 -1
- package/lib/zip-core-base.js +5 -3
- package/lib/zip-fs-native.js +2 -2
- package/lib/zip-fs-wasm.js +2 -2
- package/lib/zip-legacy.js +2 -2
- package/lib/zip-module-native.js +2 -2
- package/lib/zip-module-wasm.js +3 -3
- package/lib/zip-native.js +2 -2
- package/lib/zip-wasm.js +2 -2
- package/package.json +3 -3
- package/worker-message-property-names.js +3 -0
- package/.github/workflows/publish.yml +0 -30
- package/reserved-property-names.js +0 -50
package/index.d.cts
CHANGED
|
@@ -197,6 +197,11 @@ declare class TransformStreamLike {
|
|
|
197
197
|
*/
|
|
198
198
|
export function configure(configuration: Configuration): void;
|
|
199
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Restores the default configuration of zip.js
|
|
202
|
+
*/
|
|
203
|
+
export function resetConfiguration(): void;
|
|
204
|
+
|
|
200
205
|
/**
|
|
201
206
|
* Represents the configuration passed to {@link configure}.
|
|
202
207
|
*/
|
|
@@ -494,6 +499,16 @@ export class Reader<Type> implements Initializable, ReadableReader {
|
|
|
494
499
|
* Initializes the instance asynchronously
|
|
495
500
|
*/
|
|
496
501
|
init?(): Promise<void>;
|
|
502
|
+
/**
|
|
503
|
+
* Creates a `ReadableStream` of the data, optionally restricted to a byte range.
|
|
504
|
+
*
|
|
505
|
+
* The default implementation reads the data with {@link Reader#readUint8Array}. Custom readers can
|
|
506
|
+
* override this method to return a stream provided natively by the underlying data source.
|
|
507
|
+
*
|
|
508
|
+
* @param options The options.
|
|
509
|
+
* @returns The `ReadableStream` instance.
|
|
510
|
+
*/
|
|
511
|
+
createReadable(options?: CreateReadableOptions): ReadableStream<Uint8Array>;
|
|
497
512
|
/**
|
|
498
513
|
* Reads a chunk of data
|
|
499
514
|
*
|
|
@@ -504,6 +519,27 @@ export class Reader<Type> implements Initializable, ReadableReader {
|
|
|
504
519
|
readUint8Array(index: number, length: number): Promise<Uint8Array>;
|
|
505
520
|
}
|
|
506
521
|
|
|
522
|
+
/**
|
|
523
|
+
* Represents the options passed to {@link Reader#createReadable}.
|
|
524
|
+
*/
|
|
525
|
+
export interface CreateReadableOptions {
|
|
526
|
+
/**
|
|
527
|
+
* The byte offset of the start of the range to read.
|
|
528
|
+
*
|
|
529
|
+
* @defaultValue 0
|
|
530
|
+
*/
|
|
531
|
+
offset?: number;
|
|
532
|
+
/**
|
|
533
|
+
* The size of the range to read in bytes (until the end of the data by default).
|
|
534
|
+
*/
|
|
535
|
+
size?: number;
|
|
536
|
+
/**
|
|
537
|
+
* The size in bytes of the chunks emitted by the default implementation (the `chunkSize` value
|
|
538
|
+
* of the global configuration by default).
|
|
539
|
+
*/
|
|
540
|
+
chunkSize?: number;
|
|
541
|
+
}
|
|
542
|
+
|
|
507
543
|
/**
|
|
508
544
|
* Represents a {@link Reader} instance used to read data provided as a `string`.
|
|
509
545
|
*/
|
|
@@ -617,6 +653,15 @@ export interface HttpRangeOptions {
|
|
|
617
653
|
* The HTTP headers.
|
|
618
654
|
*/
|
|
619
655
|
headers?: Iterable<[string, string]> | Map<string, string>;
|
|
656
|
+
/**
|
|
657
|
+
* `true` to throw an {@link ERR_HTTP_RESOURCE_CHANGED} error when the `ETag`, `Last-Modified` or total size headers
|
|
658
|
+
* returned by a range request differ from the ones returned by the first range request, i.e. when the resource has
|
|
659
|
+
* been modified while being read. Headers missing from the responses are ignored, note that `Access-Control-Expose-Headers`
|
|
660
|
+
* must include them when the resource is fetched cross-origin.
|
|
661
|
+
*
|
|
662
|
+
* @defaultValue true
|
|
663
|
+
*/
|
|
664
|
+
checkResourceChanges?: boolean;
|
|
620
665
|
}
|
|
621
666
|
|
|
622
667
|
/**
|
|
@@ -763,6 +808,10 @@ export class SplitDataWriter implements Initializable, WritableWriter {
|
|
|
763
808
|
* Initializes the instance asynchronously
|
|
764
809
|
*/
|
|
765
810
|
init(): Promise<void>;
|
|
811
|
+
/**
|
|
812
|
+
* Closes the disk being written, the next disk being opened when more data is written
|
|
813
|
+
*/
|
|
814
|
+
closeDisk(): Promise<void>;
|
|
766
815
|
/**
|
|
767
816
|
* Creates the {@link SplitDataWriter} instance
|
|
768
817
|
*
|
|
@@ -2729,6 +2778,10 @@ export const fs: {
|
|
|
2729
2778
|
* HTTP range error
|
|
2730
2779
|
*/
|
|
2731
2780
|
export const ERR_HTTP_RANGE: string;
|
|
2781
|
+
/**
|
|
2782
|
+
* HTTP resource changed while being read error
|
|
2783
|
+
*/
|
|
2784
|
+
export const ERR_HTTP_RESOURCE_CHANGED: string;
|
|
2732
2785
|
/**
|
|
2733
2786
|
* Zip format error
|
|
2734
2787
|
*/
|
package/index.d.ts
CHANGED
|
@@ -197,6 +197,11 @@ declare class TransformStreamLike {
|
|
|
197
197
|
*/
|
|
198
198
|
export function configure(configuration: Configuration): void;
|
|
199
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Restores the default configuration of zip.js
|
|
202
|
+
*/
|
|
203
|
+
export function resetConfiguration(): void;
|
|
204
|
+
|
|
200
205
|
/**
|
|
201
206
|
* Represents the configuration passed to {@link configure}.
|
|
202
207
|
*/
|
|
@@ -494,6 +499,16 @@ export class Reader<Type> implements Initializable, ReadableReader {
|
|
|
494
499
|
* Initializes the instance asynchronously
|
|
495
500
|
*/
|
|
496
501
|
init?(): Promise<void>;
|
|
502
|
+
/**
|
|
503
|
+
* Creates a `ReadableStream` of the data, optionally restricted to a byte range.
|
|
504
|
+
*
|
|
505
|
+
* The default implementation reads the data with {@link Reader#readUint8Array}. Custom readers can
|
|
506
|
+
* override this method to return a stream provided natively by the underlying data source.
|
|
507
|
+
*
|
|
508
|
+
* @param options The options.
|
|
509
|
+
* @returns The `ReadableStream` instance.
|
|
510
|
+
*/
|
|
511
|
+
createReadable(options?: CreateReadableOptions): ReadableStream<Uint8Array>;
|
|
497
512
|
/**
|
|
498
513
|
* Reads a chunk of data
|
|
499
514
|
*
|
|
@@ -504,6 +519,27 @@ export class Reader<Type> implements Initializable, ReadableReader {
|
|
|
504
519
|
readUint8Array(index: number, length: number): Promise<Uint8Array>;
|
|
505
520
|
}
|
|
506
521
|
|
|
522
|
+
/**
|
|
523
|
+
* Represents the options passed to {@link Reader#createReadable}.
|
|
524
|
+
*/
|
|
525
|
+
export interface CreateReadableOptions {
|
|
526
|
+
/**
|
|
527
|
+
* The byte offset of the start of the range to read.
|
|
528
|
+
*
|
|
529
|
+
* @defaultValue 0
|
|
530
|
+
*/
|
|
531
|
+
offset?: number;
|
|
532
|
+
/**
|
|
533
|
+
* The size of the range to read in bytes (until the end of the data by default).
|
|
534
|
+
*/
|
|
535
|
+
size?: number;
|
|
536
|
+
/**
|
|
537
|
+
* The size in bytes of the chunks emitted by the default implementation (the `chunkSize` value
|
|
538
|
+
* of the global configuration by default).
|
|
539
|
+
*/
|
|
540
|
+
chunkSize?: number;
|
|
541
|
+
}
|
|
542
|
+
|
|
507
543
|
/**
|
|
508
544
|
* Represents a {@link Reader} instance used to read data provided as a `string`.
|
|
509
545
|
*/
|
|
@@ -617,6 +653,15 @@ export interface HttpRangeOptions {
|
|
|
617
653
|
* The HTTP headers.
|
|
618
654
|
*/
|
|
619
655
|
headers?: Iterable<[string, string]> | Map<string, string>;
|
|
656
|
+
/**
|
|
657
|
+
* `true` to throw an {@link ERR_HTTP_RESOURCE_CHANGED} error when the `ETag`, `Last-Modified` or total size headers
|
|
658
|
+
* returned by a range request differ from the ones returned by the first range request, i.e. when the resource has
|
|
659
|
+
* been modified while being read. Headers missing from the responses are ignored, note that `Access-Control-Expose-Headers`
|
|
660
|
+
* must include them when the resource is fetched cross-origin.
|
|
661
|
+
*
|
|
662
|
+
* @defaultValue true
|
|
663
|
+
*/
|
|
664
|
+
checkResourceChanges?: boolean;
|
|
620
665
|
}
|
|
621
666
|
|
|
622
667
|
/**
|
|
@@ -763,6 +808,10 @@ export class SplitDataWriter implements Initializable, WritableWriter {
|
|
|
763
808
|
* Initializes the instance asynchronously
|
|
764
809
|
*/
|
|
765
810
|
init(): Promise<void>;
|
|
811
|
+
/**
|
|
812
|
+
* Closes the disk being written, the next disk being opened when more data is written
|
|
813
|
+
*/
|
|
814
|
+
closeDisk(): Promise<void>;
|
|
766
815
|
/**
|
|
767
816
|
* Creates the {@link SplitDataWriter} instance
|
|
768
817
|
*
|
|
@@ -2729,6 +2778,10 @@ export const fs: {
|
|
|
2729
2778
|
* HTTP range error
|
|
2730
2779
|
*/
|
|
2731
2780
|
export const ERR_HTTP_RANGE: string;
|
|
2781
|
+
/**
|
|
2782
|
+
* HTTP resource changed while being read error
|
|
2783
|
+
*/
|
|
2784
|
+
export const ERR_HTTP_RESOURCE_CHANGED: string;
|
|
2732
2785
|
/**
|
|
2733
2786
|
* Zip format error
|
|
2734
2787
|
*/
|