Initial commit

This commit is contained in:
undergroundwires
2019-12-31 16:09:39 +01:00
commit 4e7f244190
108 changed files with 17296 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import fileSaver from 'file-saver';
export class SaveFileDialog {
public static saveText(text: string, fileName: string): void {
this.saveBlob(text, 'text/plain;charset=utf-8', fileName);
}
private static saveBlob(file: BlobPart, fileType: string, fileName: string): void {
try {
const blob = new Blob([file], { type: fileType });
fileSaver.saveAs(blob, fileName);
} catch (e) {
window.open('data:' + fileType + ',' + encodeURIComponent(file.toString()), '_blank', '');
}
}
}