MCPcopy Create free account
hub / github.com/GamerHack/GamerHack.github.io / send

Function send

g2all/900/module/utils.js:49–65  ·  view source on GitHub ↗
(url, buffer, file_name, onload = () => {})

Source from the content-addressed store, hash-verified

47}
48
49export async function send(url, buffer, file_name, onload = () => {}) {
50 const file = new File(
51 [buffer],
52 file_name,
53 { type: 'application/octet-stream' }
54 );
55 const form = new FormData();
56 form.append('upload', file);
57
58 log('send');
59 const response = await fetch(url, { method: 'POST', body: form });
60
61 if (!response.ok) {
62 throw Error(`Network response was not OK, status: ${response.status}`);
63 }
64 onload();
65}
66
67export function sleep(ms = 0) {
68 return new Promise(resolve => setTimeout(resolve, ms));

Callers 4

dumpFunction · 0.90
dump_libwebkitFunction · 0.90
dump_evalFunction · 0.90
dump_scrollLeftFunction · 0.90

Calls 1

logFunction · 0.70

Tested by

no test coverage detected