Skip to content

Trouble loading ZipReader from locally saved script #486

Answered by gildas-lormeau
rjthorne asked this question in Q&A
Discussion options

You must be logged in to vote

You have to call new zip.ZipReader(new zip.BlobReader(zipFileInput.files[0])) instead of new ZipReader(new BlobReader(zipFileInput.files[0])) (and new zip.BlobWriter() as well) because you're not using zip.js as an ECMAScript Module (i.e. ESM).

Alternatively, you can add at the top of your code:

const { ZipReader, BlobReader, BlobWriter } = zip;
...

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by rjthorne
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants