function writeFile(fileName, text) {
var blob = new Blob([text], { type: 'text/plain' });
objURL = window.URL.createObjectURL(blob);
if (window.__Xr_objURL_forCreatingFile__) {
window.URL.revokeObjectURL(window.__Xr_objURL_forCreatingFile__);
}
window.__Xr_objURL_forCreatingFile__ = objURL;
var a = document.createElement('a');
a.download = fileName;
a.href = objURL;
a.click();
}
'Web' 카테고리의 다른 글
[javascript] 로컬 파일 불러오기 (chrome) (0) | 2019.07.31 |
---|