gildas-lormeau / zip.js

JavaScript library to zip and unzip files supporting multi-core compression, compression streams, zip64, split files and encryption.
https://gildas-lormeau.github.io/zip.js
BSD 3-Clause "New" or "Revised" License
3.42k stars 512 forks source link

TypeError: zip.BlobReader is not a constructor when unzipping #340

Closed devtonhere closed 2 years ago

devtonhere commented 2 years ago
  1. I've downloaded the zip for this repository from GitHub via the UI.
  2. opened https://gildas-lormeau.github.io/zip.js/demos/demo-read-file.html
  3. choosen the downloaded zip and get the error as a JavaScript prompt:
TypeError: zip.BlobReader is not a constructor 

No errors in the browser console during the unzip attempt, but there are these errors when the page loads:

Uncaught TypeError: class heritage _ is not an object or null
    <anonymous> https://gildas-lormeau.github.io/zip.js/demos/lib/zip.min.js:1
    <anonymous> https://gildas-lormeau.github.io/zip.js/demos/lib/zip.min.js:1
    <anonymous> https://gildas-lormeau.github.io/zip.js/demos/lib/zip.min.js:1
[zip.min.js:1:2361](https://gildas-lormeau.github.io/zip.js/demos/lib/zip.min.js)
Uncaught TypeError: zip.configure is not a function
    selectInflateImplementation https://gildas-lormeau.github.io/zip.js/demos/demo-read-file.js:87
    <anonymous> https://gildas-lormeau.github.io/zip.js/demos/demo-read-file.js:41
    <anonymous> https://gildas-lormeau.github.io/zip.js/demos/demo-read-file.js:164
    <anonymous> https://gildas-lormeau.github.io/zip.js/demos/demo-read-file.js:166
[demo-read-file.js:87:8](https://gildas-lormeau.github.io/zip.js/demos/demo-read-file.js)
    selectInflateImplementation https://gildas-lormeau.github.io/zip.js/demos/demo-read-file.js:87
    <anonymous> https://gildas-lormeau.github.io/zip.js/demos/demo-read-file.js:41
    <anonymous> https://gildas-lormeau.github.io/zip.js/demos/demo-read-file.js:164
    <anonymous> https://gildas-lormeau.github.io/zip.js/demos/demo-read-file.js:166
gildas-lormeau commented 2 years ago

This is because your browser does not support the TransformStream API. You can use the 2.4.x version to fix this here: https://github.com/gildas-lormeau/zip.js/releases/tag/v2.4.26.

gildas-lormeau commented 2 years ago

Alternatively, including https://unpkg.com/web-streams-polyfill/dist/polyfill.min.js in your page should fix the issue.

devtonhere commented 2 years ago

Thanks, updating my firefox did help as well ;)

https://caniuse.com/mdn-api_transformstream

gildas-lormeau commented 2 years ago

For the record, I added the polyfill in the demos.