file download is added
This commit is contained in:
parent
a7dbb1f545
commit
9417b757da
|
@ -56,6 +56,19 @@ export class FileUtil {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static downloadFromBlob(blob: Blob, fileName: string) {
|
||||||
|
const a = document.createElement('a');
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.style.display = 'none';
|
||||||
|
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
a.href = url;
|
||||||
|
a.download = fileName;
|
||||||
|
a.click();
|
||||||
|
window.URL.revokeObjectURL(url);
|
||||||
|
a.remove();
|
||||||
|
}
|
||||||
|
|
||||||
static thumbnail(file: File): Promise<File> {
|
static thumbnail(file: File): Promise<File> {
|
||||||
return new Promise<File>((resolve, reject) => {
|
return new Promise<File>((resolve, reject) => {
|
||||||
const fileReader = new FileReader();
|
const fileReader = new FileReader();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user