13 lines
No EOL
392 B
JavaScript
13 lines
No EOL
392 B
JavaScript
export function DownloadFile(filename, contentType, content) {
|
|
const file = new File([content], filename, { type: contentType});
|
|
const exportUrl = URL.createObjectURL(file);
|
|
|
|
const a = document.createElement("a");
|
|
document.body.appendChild(a);
|
|
a.href = exportUrl;
|
|
a.download = filename;
|
|
a.target = "_self";
|
|
a.click();
|
|
|
|
URL.revokeObjectURL(exportUrl);
|
|
} |