Converting base64 to blob in javascript

  fetch("data:image/jpeg;base64," + base64Data)
    .then(res => res.blob())
    .then(blob => {
      console.log(blob);
      var url = window.URL.createObjectURL(blob);
    });

Try this out. Please note that dataURI is assumed to include base64 prefix. (e.g. "data:image/jpeg;base64,")

function b64toBlob(dataURI) {
    
    var byteString = atob(dataURI.split(',')[1]);
    var ab = new ArrayBuffer(byteString.length);
    var ia = new Uint8Array(ab);
    
    for (var i = 0; i < byteString.length; i++) {
        ia[i] = byteString.charCodeAt(i);
    }
    return new Blob([ab], { type: 'image/jpeg' });
}

Usage:

...

var blob = b64toBlob(imageData);

var formData = new FormData();
formData.append("source", blob);
...

Please try this simple way

  fetch(base64).then(res => return res.blob()).then(blob => console.log(blob));