Finally, the file is generated as a base64-encoded image. It is usually necessary to convert the base64 to a blob (to prevent the generated file from being too large)
Convert base64 to blob
constdataURLtoBlob=(dataURI: any)=>{
if(dataURI){
let arr = dataURI.split(',')let fileType = arr[0].match(/:(.*?);/)let type
if(fileType){
type = fileType[1]}let binary =atob(arr[1])let len = binary.length
let array =newUint8Array(len);for(let i =0; i < len; i++){
array[i]= binary.charCodeAt(i);}returnnewBlob([array],{
type });}}