我正在使用 JSZip 打开一个 zip 文件。使用 npapi-file-io 插件循环并将每个文件保存为二进制文件。问题是; 它很慢。即使是 2mb 的 zip 文件,在本地提取 zip 也需要几分钟时间。如果我将文件保存为文本文件,它会非常快。但它们必须保存为二进制文件,否则它们会损坏。有任何想法吗?请告诉我我做错了或很难。
//read contents of zip file
var zip = new JSZip(e.target.result);
$.each(zip.files, function (index, zipEntry) {
var filename = zipEntry.name;
//create directory else create file
var path = getPath(filename);
if (filename.match(/\/$/)) {
//plugin is the embeded npapi-file-io plugin
plugin.createDirectory(path);
} else {
//problem is here
plugin.saveBinaryFile(path, zipEntry.asUint8Array());
//this is faster and works with the txt files but not images ect.
//plugin.saveTextFile(path, zipEntry.data);
}