function toDataURL(url) {
fetch(url)
.then(response => response.blob())
.then(blob => new Promise((resolve, reject) => {
const reader = new FileReader()
reader.onloadend = () => resolve(reader.result)
reader.onerror = reject
reader.readAsDataURL(blob)
}));
}
function base64ToFileObj(filePath, fileName) {
toDataURL(filePath)
.then(dataUrl => {
console.log('RESULT:', dataUrl.length)
const url = dataUrl;
fetch(url)
.then(res => res.blob())
.then(blob => {
const file = new File([blob], fileName, {
type: "image/png"
})
console.log('fileObj', file);
});
})
}