(buffer)
| 81 | } |
| 82 | |
| 83 | export async function send(url, buffer, file_name, onload = () => {}) { |
| 84 | const file = new File([buffer], file_name, { type: "application/octet-stream" }); |
| 85 | const form = new FormData(); |
| 86 | form.append("upload", file); |
| 87 | |
| 88 | log("send"); |
| 89 | const response = await fetch(url, { method: "POST", body: form }); |
| 90 | |
| 91 | if (!response.ok) { |
| 92 | throw Error(`Network response was not OK, status: ${response.status}`); |
| 93 | } |