@zip.js/zip.js 2.7.57 → 2.7.58

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/dist/zip-full.js CHANGED
@@ -6774,6 +6774,7 @@
6774
6774
  const ERR_HTTP_STATUS = "HTTP error ";
6775
6775
  const ERR_HTTP_RANGE = "HTTP Range not supported";
6776
6776
  const ERR_ITERATOR_COMPLETED_TOO_SOON = "Writer iterator completed too soon";
6777
+ const ERR_WRITER_NOT_INITIALIZED = "Writer not initialized";
6777
6778
 
6778
6779
  const CONTENT_TYPE_TEXT_PLAIN = "text/plain";
6779
6780
  const HTTP_HEADER_CONTENT_LENGTH = "Content-Length";
@@ -6811,8 +6812,10 @@
6811
6812
  async pull(controller) {
6812
6813
  const { offset = 0, size, diskNumberStart } = readable;
6813
6814
  const { chunkOffset } = this;
6814
- controller.enqueue(await readUint8Array(reader, offset + chunkOffset, Math.min(chunkSize, size - chunkOffset), diskNumberStart));
6815
- if (chunkOffset + chunkSize > size) {
6815
+ const dataSize = size === UNDEFINED_VALUE ? chunkSize : Math.min(chunkSize, size - chunkOffset);
6816
+ const data = await readUint8Array(reader, offset + chunkOffset, dataSize, diskNumberStart);
6817
+ controller.enqueue(data);
6818
+ if ((chunkOffset + chunkSize > size) || (size === UNDEFINED_VALUE && !data.length && dataSize)) {
6816
6819
  controller.close();
6817
6820
  } else {
6818
6821
  this.chunkOffset += chunkSize;
@@ -6830,6 +6833,9 @@
6830
6833
  const writer = this;
6831
6834
  const writable = new WritableStream({
6832
6835
  write(chunk) {
6836
+ if (!writer.initialized) {
6837
+ throw new Error(ERR_WRITER_NOT_INITIALIZED);
6838
+ }
6833
6839
  return writer.writeUint8Array(chunk);
6834
6840
  }
6835
6841
  });
@@ -9546,6 +9552,7 @@
9546
9552
  exports.ERR_UNSUPPORTED_COMPRESSION = ERR_UNSUPPORTED_COMPRESSION;
9547
9553
  exports.ERR_UNSUPPORTED_ENCRYPTION = ERR_UNSUPPORTED_ENCRYPTION;
9548
9554
  exports.ERR_UNSUPPORTED_FORMAT = ERR_UNSUPPORTED_FORMAT;
9555
+ exports.ERR_WRITER_NOT_INITIALIZED = ERR_WRITER_NOT_INITIALIZED;
9549
9556
  exports.HttpRangeReader = HttpRangeReader;
9550
9557
  exports.HttpReader = HttpReader;
9551
9558
  exports.Reader = Reader;