下载/解压缩20MB需要15分钟

时间:2014-10-20 17:10:53

标签: javascript cordova zip

我有一个需要字典类型的应用程序。有图像和声音。可以使用多个词典。当你将图像+声音+数据加起来时,每一个大约是20MB一块。

我们决定将这些文件单独发送为用户下载的单个zip文件。 问题是在这些手机上解压缩200多个声音文件需要FOREVER。下载大约需要1分钟,解压缩可能需要10分钟。

我们有一个想法制作一个声音精灵所以它是1个文件,我相信这会有所帮助,但有没有人有任何其他建议来帮助解决这个问题?

这是解压缩代码。使用http://plugins.cordova.io/#/package/org.chromium.zip插件

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;
};

我测试了一堆不同的现代手机,moto x,ssgs4和5以及iphone 5s和5.当我通过手机上的控制台手动运行插件时,我发现它作为声音精灵文件解压得比较快200多个声音文件。我想知道这是否是去这里的唯一途径。

0 个答案:

没有答案