我正在尝试构建一个Firefox插件,从网页请求一个zip文件并将其存储在本地/解压缩。当我以Blob类型请求zip时,我收到200响应代码,但由于Firefox的文件I/O文档相当混乱,我不确定如何存储它。
getFiles : function (version) {
if(version != "?"){
var xmlhttp=new XMLHttpRequest();
url = "http://github.com/wet-boew/wet-boew/archive/master.zip"
xmlhttp.open("GET", url, true);
xmlhttp.responseType = 'blob';
xmlhttp.onload = function(e) {
if (this.status == 200) {
// Note: .response instead of .responseText
var blob = new Blob([this.response], {type: 'compress/zip'});
}
};
xmlhttp.send();
}
return zip;
},
非常感谢您的帮助和建议!