How to convert js base64 pictures to binary

because I want to send a picture to the app end, I have to send them a binary picture. I can"t even use Blob to solve the base64. How to transfer the base64 picture to the app end in binary form

Apr.22,2021

/**
 * base64urlBlob
 * @param urlData
 *        urlbase64
 */
function convertBase64UrlToBlob(urlData){
    var arr = urlData.split(','), mime = arr[0].match(/:(.*?);/)[1],
        bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
    while(n--){
        u8arr[n] = bstr.charCodeAt(n);
    }
    return new Blob([u8arr], {type:mime});
}

if you want to use the form, it is:

var formData = new FormData() ;
var blobDate = convertBase64UrlToBlob( base64 );
formData.append("file", blobDate); // 

Blob object is fine, isn't it?


has been solved. Just send base64. You don't have to convert to binary

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e585bb-66e49.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e585bb-66e49.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?