use download helper

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
TRIGUBF
2023-08-25 11:35:23 +02:00
committed by Fredrik Adelöw
parent 4d8aeacfa5
commit eb8a79542e
@@ -28,6 +28,7 @@ import DeleteIcon from '@material-ui/icons/Delete';
import DownloadIcon from '@material-ui/icons/GetApp';
import React from 'react';
import { DryRunResult, useDryRun } from '../DryRunContext';
import { downloadBlob } from '../../../lib/download';
const useStyles = makeStyles((theme: BackstageTheme) => ({
root: {
@@ -117,14 +118,3 @@ async function createZipDownload(directoryContents: { path: string; base64Conten
throw new Error(err);
});
}
function downloadBlob(blob: Blob, name: string) {
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = name;
a.click();
URL.revokeObjectURL(a.href);
a.remove();
}