mirror of
https://github.com/chylex/Discord-History-Tracker.git
synced 2025-06-12 13:22:29 +03:00
Use blob to allow larger downloads
This commit is contained in:
parent
54cfe57c47
commit
8c3a55eb58
@ -95,14 +95,15 @@ var DOM = (function(){
|
|||||||
* Triggers a UTF-8 text file download.
|
* Triggers a UTF-8 text file download.
|
||||||
*/
|
*/
|
||||||
downloadTextFile: function(fileName, fileContents){
|
downloadTextFile: function(fileName, fileContents){
|
||||||
var ele = document.createElement("a");
|
var a = document.createElement("a");
|
||||||
ele.setAttribute("href", "data:text/plain;charset=utf-8,"+encodeURIComponent(fileContents));
|
document.body.appendChild(a);
|
||||||
ele.setAttribute("download", fileName);
|
a.style = "display: none";
|
||||||
ele.style.display = "none";
|
var blob = new Blob([fileContents], {type: "octet/stream"}),
|
||||||
|
url = window.URL.createObjectURL(blob);
|
||||||
document.body.appendChild(ele);
|
a.href = url;
|
||||||
ele.click();
|
a.download = fileName;
|
||||||
document.body.removeChild(ele);
|
a.click();
|
||||||
|
window.URL.revokeObjectURL(url);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user