Created
August 13, 2020 04:59
-
-
Save rezonn/d3b12b59db3796240ae87b3cc07261b7 to your computer and use it in GitHub Desktop.
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
| async function upload(canvas,url) { | |
| let blob = await (new Promise(resolve => canvas.toBlob(resolve))); | |
| try { | |
| const response = await fetch(url, | |
| { | |
| method:'POST', | |
| headers:{ | |
| 'Content-Type':'application/octet-stream' | |
| }, | |
| body:blob | |
| }); | |
| } catch(e) {console.log("fetch error: "+e.message)} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment