我有这个功能:
download(data, filename, type) {
var file = new Blob([data], {type: type});
if (window.navigator.msSaveOrOpenBlob) // IE10+
window.navigator.msSaveOrOpenBlob(file, filename);
else { // Others
var a = document.createElement("a"),
url = URL.createObjectURL(file);
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
setTimeout(function() {a
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
}, 0);
}
}
它创建一个文件。要调用它,我运行:
this.download(date, "ZZZZ.txt", ".txt");
如何将数据附加到该现有文件?假设我要在日期下方添加“测试”,我该怎么做?