mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-21 05:35:45 +01:00
12 lines
371 B
TypeScript
12 lines
371 B
TypeScript
|
export function downloadContentAsFile(content: BlobPart, filename: string): void {
|
||
|
const blob = new Blob([content]);
|
||
|
const anchorElement = document.createElement("a");
|
||
|
const url = URL.createObjectURL(blob);
|
||
|
anchorElement.href = url;
|
||
|
anchorElement.download = filename;
|
||
|
anchorElement.click();
|
||
|
setTimeout(function () {
|
||
|
URL.revokeObjectURL(url);
|
||
|
}, 0);
|
||
|
}
|