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

Incorrect values sent to onprogress for getFileEntry #41

Closed
gregpsycle opened this issue Mar 7, 2013 · 8 comments
Closed

Incorrect values sent to onprogress for getFileEntry #41

gregpsycle opened this issue Mar 7, 2013 · 8 comments

Comments

@gregpsycle
Copy link

I have a zipfs into which I've imported a blob. I'm using getFileEntry to then extract the zip to an HTML5 filesystem inside a Chrome app. This all works fine.
The onprogress callback though, is getting 'index' (first argument) values that fluctuate (i.e. don't always get bigger), and aren't always smaller than 'max size' (second argument). Max-size is correct.

I think the fix is to change line 236 in zip-fs.js from:

onprogress(currentIndex + index, totalSize);

to just:

onprogress(currentIndex, totalSize);

but I might be misunderstanding what this is meant to be doing.

@webmutation
Copy link

That does not fix the issue... test

function importZipToFilesystem(callback) {
    zipFs.importHttpContent(URL, false, function() {
        zipFs.root.getFileEntry(filesystem.root, callback,
            function(current, total){
                var totalPercentage = (current / total) * 100;
                console.log("onprogress: "+current+"total: "+total + ": "+Math.round(totalPercentage,2)+"%");
            },
            onerror);
    }, onerror);
}

This results in:
onprogress: 6099658total: 6159972: 99% test12.js:40
onprogress: 6623946total: 6159972: 108% test12.js:40
onprogress: 6102123total: 6159972: 99% test12.js:40
onprogress: 6626411total: 6159972: 108% test12.js:40
onprogress: 6104296total: 6159972: 99% test12.js:40
onprogress: 6628584total: 6159972: 108% test12.js:40
onprogress: 6108101total: 6159972: 99% test12.js:40
onprogress: 6632389total: 6159972: 108% test12.js:40
onprogress: 6110440total: 6159972: 99% test12.js:40
onprogress: 6634728total: 6159972: 108% test12.js:40
onprogress: 6116259total: 6159972: 99% test12.js:40
onprogress: 6640547total: 6159972: 108% test12.js:40
onprogress: 6118637total: 6159972: 99% test12.js:40
onprogress: 6642925total: 6159972: 108% test12.js:40
onprogress: 6121838total: 6159972: 99% test12.js:40
onprogress: 6646126total: 6159972: 108% test12.js:40
onprogress: 6124152total: 6159972: 99% test12.js:40
onprogress: 6648440total: 6159972: 108% test12.js:40
onprogress: 6129858total: 6159972: 100% test12.js:40
onprogress: 6654146total: 6159972: 108% test12.js:40
onprogress: 6132118total: 6159972: 100% test12.js:40
onprogress: 6656406total: 6159972: 108% test12.js:40
onprogress: 6136614total: 6159972: 100% test12.js:40
onprogress: 6660902total: 6159972: 108% test12.js:40
onprogress: 6139416total: 6159972: 100% test12.js:40
onprogress: 6663704total: 6159972: 108% test12.js:40
onprogress: 6145408total: 6159972: 100% test12.js:40
onprogress: 6669696total: 6159972: 108% test12.js:40
onprogress: 6145955total: 6159972: 100% test12.js:40
onprogress: 6670243total: 6159972: 108% test12.js:40
onprogress: 6156164total: 6159972: 100% test12.js:40
onprogress: 6680452total: 6159972: 108% test12.js:40
onprogress: 6156642total: 6159972: 100% test12.js:40
onprogress: 6680930total: 6159972: 108% test12.js:40
onprogress: 6157119total: 6159972: 100% test12.js:40
onprogress: 6681407total: 6159972: 108% test12.js:40
onprogress: 6157597total: 6159972: 100% test12.js:40
onprogress: 6681885total: 6159972: 108% test12.js:40
onprogress: 6158075total: 6159972: 100% test12.js:40
onprogress: 6682363total: 6159972: 108% test12.js:40
onprogress: 6158553total: 6159972: 100% test12.js:40
onprogress: 6682841total: 6159972: 108% test12.js:40
onprogress: 6159026total: 6159972: 100% test12.js:40
onprogress: 6683314total: 6159972: 108% test12.js:40
onprogress: 6159503total: 6159972: 100% test12.js:40
onprogress: 6683791total: 6159972: 109% test12.js:40
Importing Zip - Complete!

The problem seem like uncompressed size and total size is compressed... there is an issue, but that does not fix it.

@webmutation
Copy link

I did a second test and it appear to fix the issue, my apologies. It was probably cached... there are however multiple callbacks for the same file, haven't' found a workaround for that yet:

Unzip FILE: page0001_i1.jpg zip-fs.js:235
onprogress: 59964 Total: 6585296: 1 % fs-lib.js:53
Unzip FILE: page0001_i1.jpg zip-fs.js:235
onprogress: 59964 Total: 6585296: 1 % fs-lib.js:53
Unzip CHILD: page0001_i1.jpg zip-fs.js:213
Unzip FILE: page0001_i2.jpg zip-fs.js:235
onprogress: 86247 Total: 6585296: 1 % fs-lib.js:53
Unzip FILE: page0001_i2.jpg zip-fs.js:235
onprogress: 86247 Total: 6585296: 1 % fs-lib.js:53
Unzip CHILD: page0001_i2.jpg zip-fs.js:213
Unzip FILE: page0002_i1.jpg zip-fs.js:235
onprogress: 145455 Total: 6585296: 2 % fs-lib.js:53
Unzip FILE: page0002_i1.jpg zip-fs.js:235
onprogress: 145455 Total: 6585296: 2 % fs-lib.js:53
Unzip CHILD: page0002_i1.jpg zip-fs.js:213
Unzip FILE: page0002_i2.jpg zip-fs.js:235
onprogress: 191103 Total: 6585296: 3 % fs-lib.js:53
Unzip FILE: page0002_i2.jpg zip-fs.js:235
onprogress: 191103 Total: 6585296: 3 % fs-lib.js:53
Unzip CHILD: page0002_i2.jpg zip-fs.js:213
Unzip FILE: page0003_i1.jpg zip-fs.js:235
onprogress: 294790 Total: 6585296: 4 % fs-lib.js:53
Unzip FILE: page0003_i1.jpg zip-fs.js:235
onprogress: 294790 Total: 6585296: 4 % fs-lib.js:53
Unzip CHILD: page0003_i1.jpg zip-fs.js:213
Unzip FILE: page0003_i2.jpg zip-fs.js:235
onprogress: 339720 Total: 6585296: 5 % fs-lib.js:53
Unzip FILE: page0003_i2.jpg zip-fs.js:235
onprogress: 339720 Total: 6585296: 5 % fs-lib.js:53
Unzip CHILD: page0003_i2.jpg zip-fs.js:213
Unzip FILE: page0004_i1.jpg zip-fs.js:235
onprogress: 445176 Total: 6585296: 7 % fs-lib.js:53
Unzip FILE: page0004_i1.jpg zip-fs.js:235
onprogress: 445176 Total: 6585296: 7 % fs-lib.js:53
Unzip CHILD: page0004_i1.jpg

@gildas-lormeau
Copy link
Owner

Hi,

Thanks for filling the issue

I'm really sorry but I can't work on zip.js issues currently. I hope I'll find some free time in one week or two...

@danielweck
Copy link

@gregpsycle removing + index works for me too.
Note that onprogress(currentIndex + index, totalSize); is wrong for the export function too (in the same file zip-fs.js)

@Rob--W
Copy link
Collaborator

Rob--W commented Oct 11, 2015

@danielweck / @gregpsycle Patches are welcome ;)

@gildas-lormeau
Copy link
Owner

I was able to reproduce the issue, it should be fixed now.

@danielweck
Copy link

2013 ... how time passes :)

@gildas-lormeau
Copy link
Owner

You bet! :)

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

5 participants