This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function blob2File(blob, name, type) { | |
| return new File([blob], name, type ? { type: type } : undefined); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function dataURLToBlob(dataURL) { | |
| var BASE64_MARKER = ';base64,'; | |
| if (dataURL.indexOf(BASE64_MARKER) == -1) { | |
| var parts = dataURL.split(','); | |
| var contentType = parts[0].split(':')[1]; | |
| var raw = decodeURIComponent(parts[1]); | |
| return new Blob([raw], {type: contentType}); | |
| } |