Created
October 20, 2014 16:57
-
-
Save optikalefx/28122ff5c93e31d0b407 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.util.unzipFile = function(url, destination, progress) { | |
var fileName = url.replace(/^.*[\\\/]/, ''); | |
var withoutExt = fileName.split('.').shift(); | |
var promise = new $.Deferred(); | |
zip.unzip(url, destination,function(done) { | |
if( done === 0) { | |
// pass the success callback a file object of the new unzipped thing | |
resolveLocalFileSystemURL(destination + "/" + withoutExt, function(unzippedFileEntry) { | |
console.log("resolving zip promise"); | |
promise.resolve(unzippedFileEntry); | |
}); | |
} else { | |
app.util.progress.stop(); | |
promise.reject(err); | |
console.log("unzip error", done); | |
} | |
}, progress); | |
return promise; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment