Skip to content

Can zip.js support safari browser unZip? #247

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

You must be logged in to vote

As I write this, Safari does not support DataView#getBigUint64 (see here) so it must be polyfilled if you want to read files using zip64. Here is below an implementation based on this response from Stack Overflow. You have to run this script before using zip.js.

if (DataView.prototype.getBigUint64 === undefined) {
  DataView.prototype.getBigUint64 = function(byteOffset, littleEndian) {
    // split 64-bit number into two 32-bit parts
    const left =  this.getUint32(byteOffset, littleEndian);
    const right = this.getUint32(byteOffset+4, littleEndian);

    // combine the two 32-bit values
    const combined = littleEndian? left + 2**32*right : 2**32*left + right;

    if (!Number.isSafe…

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
1 reply
@BarryJame
Comment options

Answer selected by gildas-lormeau
Comment options

You must be logged in to vote
7 replies
@gildas-lormeau
Comment options

@phamconganh
Comment options

@phamconganh
Comment options

@gildas-lormeau
Comment options

@gildas-lormeau
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #245 on May 19, 2021 00:05.