mirror of
				https://github.com/Warky-Devs/artemis-kit.git
				synced 2025-10-31 08:03:54 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			17 lines
		
	
	
		
			491 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			491 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| /**
 | |
|  * Converts a base64 string to a Blob object.
 | |
|  * @param base64 - The base64 encoded string to convert
 | |
|  * @returns A Blob containing the decoded binary data
 | |
|  */
 | |
| export function base64ToBlob(base64: string): Blob {
 | |
|   const byteString = atob(base64)
 | |
|   const arrayBuffer = new ArrayBuffer(byteString.length)
 | |
|   const uint8Array = new Uint8Array(arrayBuffer)
 | |
| 
 | |
|   for (let i = 0; i < byteString.length; i++) {
 | |
|     uint8Array[i] = byteString.charCodeAt(i)
 | |
|   }
 | |
| 
 | |
|   return new Blob([arrayBuffer])
 | |
| }
 |