Common: Utils: init data url to file

This commit is contained in:
Viktor Fomin 2022-09-21 03:39:38 +03:00
parent 3ac9b98ad2
commit 5953732f20

View File

@ -0,0 +1,9 @@
export function dataUrlToFile(url, filename, mimeType) {
return fetch(url)
.then(function (res) {
return res.arrayBuffer();
})
.then(function (buf) {
return new File([buf], filename, { type: mimeType });
});
}