mirror of
				https://github.com/Djeeberjr/fw-anwesenheit.git
				synced 2025-11-03 23:24:10 +00:00 
			
		
		
		
	added downloadBlob function
This commit is contained in:
		
							parent
							
								
									4abbd844d2
								
							
						
					
					
						commit
						141c1aa9cb
					
				
							
								
								
									
										8
									
								
								web/src/lib/downloadBlob.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								web/src/lib/downloadBlob.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					export function downloadBlob(filename: string, content: string, mimeType = "text/plain") {
 | 
				
			||||||
 | 
					  const blob = new Blob([content], { type: mimeType });
 | 
				
			||||||
 | 
					  const a = document.createElement("a");
 | 
				
			||||||
 | 
					  a.href = URL.createObjectURL(blob);
 | 
				
			||||||
 | 
					  a.download = filename;
 | 
				
			||||||
 | 
					  a.click();
 | 
				
			||||||
 | 
					  URL.revokeObjectURL(a.href);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user