Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

How to download and unzip a zip file on iPad using Phonegap and Zip.js

Avatar of sgotte
sgotte asked on
Responsive WebiOSWeb Applications
1 Comment1 Solution1211 ViewsLast Modified:
Hello,
I'm trying to unzip a zip file on ipad that's been downloaded onto the device.  The app itself is build using Phonegap javascript code.  I'm trying to do this using zip.js in combination with FileWriter. The code I have so far is included in the attached file.

Here's the list of console messages that appear on Safari Debug:

Log -  successfully downloaded
Log -  Got the zip file from device storage
Log -  zip reader created
Log -  Got the entries
Log -  Outer: pdf
Log -  Outer: jpg
Log -  js/inflate.js
Log -  Got data from the entries
Log -  Got new file to create
Log -  Inner: jpg
Log -  Write completed.
Log -  Got data from the entries
Log -  Got new file to create  
Log -  Inner: jpg
Log -  Write completed.
Log -  Got data from the entries
Log -  Got new file to create  
Log -  Inner: jpg
Log -  Write completed.

In the above unzipping case, there were in fact 3 files in the zip file and the filenames from entries(i).filename were recorded correctly in Sqlite.  However, there were 2 pdfs and 1 jpeg file in the zip I'm currently trying  to extract, but according to the above console output, it seems there's some synchronicity issue with the way I've written this code since it's trying to extract 3 jpegs it appears.  Also, when I try to view any of the downloaded/unzipped files on the device, the console reports:
TypeError: 'undefined' is not an object (evaluating 'event.url')
TypeError: 'undefined' is not an object (evaluating 'event.type')

So there appears to be an issue with the blob of data from the extracted files that is used in the writer.

Has anyone used zip.js successfully in combination with FileWriter to unzip a file onto an ipad device.  For reference, the zip.js I'm referring to is from here: http://gildas-lormeau.github.io/zip.js/

I also tried using chromeutils zip functionality which some people have reported having success with to unzip files on devices, but my app is specifically for iPad, so it seems I can't use that.

If you know of any other way to extract the downloaded zip file onto an iPad device, I am also all ears.

Thank you for your assistance.
ASKER CERTIFIED SOLUTION
Avatar of sgotte
sgotte

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answers