@zip.js/zip.js 2.7.42 → 2.7.44

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/index.d.ts CHANGED
@@ -629,15 +629,21 @@ export class Uint8ArrayWriter extends Writer<Uint8Array> { }
629
629
  * Represents an instance used to create an unzipped stream.
630
630
  *
631
631
  * @example
632
- * This example will take a zip file, decompress it and then recompress each file in it, saving it to disk.
632
+ * This example will take a zip file, decompress it and then save its files and directories to disk.
633
633
  * ```
634
- * for await (const entry of (await fetch(urlToZippedFile)).body.pipeThrough(new ZipWriterStream()))
635
- * if (entry.readable) {
636
- * console.log(entry.filename)
637
- * entry.readable
638
- * .pipeThrough(ZipReaderStream().transform(entry.filename))
639
- * .pipeTo((await Deno.create(entry.filename + '.zip')).writable)
634
+ * import {resolve} from "https://deno.land/std/path/mod.ts";
635
+ * import {ensureDir, ensureFile} from "https://deno.land/std/fs/mod.ts";
636
+ *
637
+ * for await (const entry of (await fetch(urlToZippedFile)).body.pipeThrough(new ZipReaderStream())) {
638
+ * const fullPath = resolve(destination, entry.filename);
639
+ * if (entry.directory) {
640
+ * await ensureDir(fullPath);
641
+ * continue;
640
642
  * }
643
+ *
644
+ * await ensureFile(fullPath);
645
+ * await entry.readable?.pipeTo((await Deno.create(fullPath)).writable);
646
+ * }
641
647
  * ```
642
648
  */
643
649
  export class ZipReaderStream<T> {
@@ -786,9 +792,9 @@ export interface GetEntriesOptions {
786
792
  *
787
793
  * @param value The raw text value.
788
794
  * @param encoding The encoding of the text.
789
- * @returns The decoded text value.
795
+ * @returns The decoded text value or `undefined` if the raw text value should be decoded by zip.js.
790
796
  */
791
- decodeText?(value: Uint8Array, encoding: string): string
797
+ decodeText?(value: Uint8Array, encoding: string): string | undefined;
792
798
  }
793
799
 
794
800
  /**
@@ -1235,7 +1241,7 @@ export interface ZipWriterConstructorOptions {
1235
1241
  /**
1236
1242
  * `true` to keep the order of the entry physically in the zip file.
1237
1243
  *
1238
- * When set to `true`, the use of web workers will be improved. However, it also prevents files larger than 4GB from being created without setting the `zip54` option to `true` explicitly.
1244
+ * When set to `true`, the use of web workers will be improved. However, it also prevents files larger than 4GB from being created without setting the `zip64` option to `true` explicitly.
1239
1245
  * Another solution to improve the use of web workers is to add entries from smallest to largest in uncompressed size.
1240
1246
  *
1241
1247
  * @defaultValue true
@@ -1355,9 +1361,9 @@ export interface ZipWriterConstructorOptions {
1355
1361
  * Encode the filename and the comment of the entry.
1356
1362
  *
1357
1363
  * @param text The text to encode.
1358
- * @returns The encoded text.
1364
+ * @returns The encoded text or `undefined` if the text should be encoded by zip.js.
1359
1365
  */
1360
- encodeText?(text: string): Uint8Array
1366
+ encodeText?(text: string): Uint8Array | undefined;
1361
1367
  }
1362
1368
 
1363
1369
  /**
@@ -1960,10 +1966,6 @@ export const ERR_BAD_FORMAT: string;
1960
1966
  * End of Central Directory Record not found error
1961
1967
  */
1962
1968
  export const ERR_EOCDR_NOT_FOUND: string;
1963
- /**
1964
- * Zip64 End of Central Directory Record not found error
1965
- */
1966
- export const ERR_EOCDR_ZIP64_NOT_FOUND: string;
1967
1969
  /**
1968
1970
  * Zip64 End of Central Directory Locator not found error
1969
1971
  */
package/index.js CHANGED
@@ -63,7 +63,6 @@ export {
63
63
  ERR_HTTP_RANGE,
64
64
  ERR_BAD_FORMAT,
65
65
  ERR_EOCDR_NOT_FOUND,
66
- ERR_EOCDR_ZIP64_NOT_FOUND,
67
66
  ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND,
68
67
  ERR_CENTRAL_DIRECTORY_NOT_FOUND,
69
68
  ERR_LOCAL_FILE_HEADER_NOT_FOUND,