@zip.js/zip.js 2.5.25 → 2.5.26

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.
@@ -7459,7 +7459,7 @@
7459
7459
  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7460
7460
  */
7461
7461
 
7462
- /* global Blob, atob, btoa, XMLHttpRequest, URL, fetch, ReadableStream, WritableStream */
7462
+ /* global Blob, atob, btoa, XMLHttpRequest, URL, fetch, ReadableStream, WritableStream, FileReader */
7463
7463
 
7464
7464
  const ERR_HTTP_STATUS = "HTTP error ";
7465
7465
  const ERR_HTTP_RANGE = "HTTP Range not supported";
@@ -7569,7 +7569,16 @@
7569
7569
 
7570
7570
  getData() {
7571
7571
  const writer = this;
7572
- return writer.blob.text();
7572
+ if (writer.blob.text && (writer.encoding === undefined || (writer.encoding && writer.encoding.toLowerCase() == "utf-8"))) {
7573
+ return writer.blob.text();
7574
+ } else {
7575
+ const reader = new FileReader();
7576
+ return new Promise((resolve, reject) => {
7577
+ reader.onload = event => resolve(event.target.result);
7578
+ reader.onerror = () => reject(reader.error);
7579
+ reader.readAsText(writer.blob, writer.encoding);
7580
+ });
7581
+ }
7573
7582
  }
7574
7583
  }
7575
7584