file to base64 function fileToBase64(file){ const reader = new FileReader(); reader.readAsDataURL(file) reader.onload = () => { console.dir(reader.result)// base64 } } base64 to file function dataURLtoFile(dataurl, filename) { var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1], bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n); while(n--){ u8arr[n] = bstr.charCodeAt(n)..