Common: Utils: init data url to file
This commit is contained in:
parent
3ac9b98ad2
commit
5953732f20
9
packages/common/utils/dataUrlToFile.js
Normal file
9
packages/common/utils/dataUrlToFile.js
Normal 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 });
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user