Answers for "convert string to file angular"

0

convert string to file angular

dataURItoBlob(dataURI) {
   const byteString = window.atob(dataURI);
   const arrayBuffer = new ArrayBuffer(byteString.length);
   const int8Array = new Uint8Array(arrayBuffer);
   for (let i = 0; i < byteString.length; i++) {
     int8Array[i] = byteString.charCodeAt(i);
   }
   const blob = new Blob([int8Array], { type: 'image/png' });    
   return blob;
}
Posted by: Guest on May-07-2022
0

convert string to file angular

const base64 = '...';
const imageName = 'name.png';
const imageBlob = this.dataURItoBlob(base64);
const imageFile = new File([imageBlob], imageName, { type: 'image/png' });
Posted by: Guest on May-07-2022

Code answers related to "convert string to file angular"

Code answers related to "Javascript"

Browse Popular Code Answers by Language