jszip-utils icon indicating copy to clipboard operation
jszip-utils copied to clipboard

Reading large zip file - JSZipUtil.getBinaryContent()

Open adnan-atex opened this issue 2 years ago • 1 comments

Hi Stuk,

Hope you're doing well. I'm using this library for one of the project and getting this error (please see below). This error occurred when the large zip file (max size: 8.8 MB on disk) used for reading the zip content. Below is the code snippet for reading the large zip file.

Can you please provide some feedback on this issue? As this is very important issue and we need to escalate urgently, so your feedback would be highly appreciable.

Code Snippet:

      new JSZip.external.Promise((resolve: any, reject: any) => {
        **JSZipUtils.getBinaryContent(filePath, (err: any, data: any)** => {
          if (err) {
            reject(err);
          } else {
            JSZip.loadAsync(data)
              .then(function(zip: any) {
                DataValidator.checkValidZipFile(zip).then((response) => {
                  setTimeout(() => {
                    let reportsMap: Map<string, Report> = ReportGenerator.getReports();
                    console.log("Report =>", reportsMap);
                    reportsResolve(reportsMap);
                  }, 1000);
                });
              }, function (error: any) {
                reportsReject(error);
              });
          }
        });

Javascript Error:

DataValidator.ts:218 ERROR Error: Uncaught (in promise): Error: InvalidStateError: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's 'responseType' is '' or 'text' (was 'arraybuffer'). Error: InvalidStateError: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's 'responseType' is '' or 'text' (was 'arraybuffer'). at xhr.onreadystatechange [as __zone_symbol__ON_PROPERTYreadystatechange] (index.js:110:32) at XMLHttpRequest.wrapFn (zone.js:818:43) at _ZoneDelegate.invokeTask (zone.js:446:35) at core.mjs:23891:55 at AsyncStackTaggingZoneSpec.onInvokeTask (core.mjs:23891:36) at _ZoneDelegate.invokeTask (zone.js:445:64) at Object.onInvokeTask (core.mjs:24192:33) at _ZoneDelegate.invokeTask (zone.js:445:64) at Zone.runTask (zone.js:214:51) at ZoneTask.invokeTask [as invoke] (zone.js:528:38) at resolvePromise (zone.js:1265:35) at resolvePromise (zone.js:1219:21) at zone.js:1332:21 at _ZoneDelegate.invokeTask (zone.js:446:35) at core.mjs:23891:55 at AsyncStackTaggingZoneSpec.onInvokeTask (core.mjs:23891:36) at _ZoneDelegate.invokeTask (zone.js:445:64) at Object.onInvokeTask (core.mjs:24192:33) at _ZoneDelegate.invokeTask (zone.js:445:64) at Zone.runTask (zone.js:214:51)

adnan-atex avatar Jul 05 '23 05:07 adnan-atex

Hi adnan,

I currently have the same problem. Were you able to solve the problem?

gedlbauer avatar Sep 16 '24 09:09 gedlbauer