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.4k stars 510 forks source link

Safari 14.1.2 error -> ReferenceError: Can't find variable: zip #492

Closed NickKilo closed 7 months ago

NickKilo commented 7 months ago

Hi there, I've written a code to download a file, which works perfectly in Chrome but in Safari on MacOS (Safari Version 14.1.2 (16611.3.10.1.6)) it returns the message: " ReferenceError: Can't find variable: zip". This refers to a part of my code in which I create a new zip writer, like: const zipWriter = new zip.ZipWriter(new zip.BlobWriter("application/zip"));

Is it because this Safari version does not support FileReader/Filewriter?

Thank you in advance for your help.

NickKilo commented 7 months ago

PS:

  1. I'm using latest release of zip.js (v 2.7.35)
  2. before trying to download, at launch I receive as well this error referring to zip-full.min.js: ' SyntaxError: Unexpected private name #g. Cannot parse class method with private name. '
gildas-lormeau commented 7 months ago

The error Unexpected private name #g cannot be thrown on packages published on NPM or Deno. I guess you used the built files from GitHub or a mirror. Anyway, I reverted the changes related to this error on GitHub. Could you try to update zip.js and run again your code?

NickKilo commented 7 months ago

Hi, thanks for your prompt reply. I confirm you I'm using the built files from GitHub, downloaded and added to the main app directory.

After updating zip.js with version 2.7.36, I now receive this error in Safari : Unhandled Promise Rejection: TypeError: options.signal must be AbortSignal It actually is the same error I was receiving with versions 2.7.34.

Hoping to find a fix to this, thank your for your time.

gildas-lormeau commented 7 months ago

I don't don't know what you are doing. Please provide some code and the full stack-trace at least.

gildas-lormeau commented 7 months ago

I'm converting the issue to a question because using AbortController is not mandatory. Feel free to provide some code if you need some help.