Open omairaslam817 opened 4 years ago
Use toDataUrl()
instead and then
/**
* Converts base 64 to File object
*
* @param base64String Image in base 64 string format
* @param name filename
*/
export const dataURLtoFile = (base64String: string, name: string, type: string): File => {
const parts = base64String.split(',');
const byteString = atob(parts[1]);
const intArray = new Uint8Array(byteString.length);
// Set the bytes of the buffer to the correct values
for (let i = 0; i < byteString.length; i++) {
intArray[i] = byteString.charCodeAt(i);
}
// IE does not support File() constructor, so we need to create blob.
// But blob differs from file only because it does not have lastModified and name, which can be added manually
const file = new Blob([intArray], { type });
file['name'] = name;
file['lastModified'] = Date.now();
return file as File;
};
why canvas.toBlob() is unfriend for edge browser ,kindly share a possible solution for edge browser