You need to get a jpg and convert to arrayBuffer, does anyone have any idea how to do this? I tried doing using a function below but without success for a Microsoft API
document.querySelector('#inputImage').addEventListener('change', function() {
var reader = new FileReader();
reader.onload = function() {
var arrayBuffer = this.result,
array = new Uint8Array(arrayBuffer);
};
You can use this function to convert your base64 Image to an Array Buffer
export async function base64ToFile(dataURL, fileName) {
const arr = dataURL.split(',');
const mime = arr[0].match(/:(.*?);/)[1];
return (fetch(dataURL)
.then(function (result) {
return result.arrayBuffer();
}));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With