Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
adnan-atex opened this issue Jul 5, 2023 · 1 comment
Open

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

adnan-atex opened this issue Jul 5, 2023 · 1 comment

Comments

@adnan-atex
Copy link

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)

@gedlbauer
Copy link

Hi adnan,

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants