JSFiddle - React, Tailwind, and code Playground
by Yeldar Kurmangaliyev
JavaScript
function saveData(blob, fileName)
{
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
var url = window.URL.createObjectURL(blob);
a.href = url;
a.download = fileName;
a.click();
window.URL.revokeObjectURL(url);
}
var xhr = new XMLHttpRequest();
xhr.open("GET", 'https://raw.githubusercontent.com/johnculviner/jquery.fileDownload/master/src/Common/FileDownloadAttribute.cs');
xhr.responseType = "blob";
xhr.onload = function () {
saveData(this.response, 'filename');
};
xhr.send();