Skip to content

Reading large zip file - JSZipUtil.getBinaryContent() #42

Description

@adnan-atex

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions