mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 04:35:46 +01:00
7b993f3550
Also refactor to dedup our own download code
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);
|
|
}
|