kea-react
Version:
Componentes comunes de react
16 lines (13 loc) • 426 B
text/typescript
import { Base64ToBlob } from "./files";
/**Descarga un Blob*/
export function download(data: Blob, filename: string) {
const a = document.createElement("a");
a.style.display = "none";
document.body.appendChild(a);
const url = window.URL.createObjectURL(data);
a.href = url;
a.download = filename;
a.click();
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
}