0👍
function getFileFormat(url) {
const byteString = atob(url.split(',')[1]);
const mimeString = url.split(',')[0].split(':')[1].split(';')[0];
const ab = new ArrayBuffer(byteString.length);
const ia = new Uint8Array(ab);
for (let i = 0; i < byteString.length; i += 1) {
ia[i] = byteString.charCodeAt(i);
}
return new Blob([ab], { type: mimeString });
}
this is what i’ve done and it’s worked. just shared if there is anyone also search for this function
-1👍
const u8arr = new Uint8Array(n);
while (n > 0) {
u8arr[n-1] = bstr.charCodeAt(n-1);
n -= 1;
}
Source:stackexchange.com