MCPcopy Create free account
hub / github.com/deepclause/agentvm / sendChunk

Function sendChunk

test/network/large-file.test.js:49–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47 let remaining = size;
48
49 function sendChunk() {
50 while (remaining > 0) {
51 const toWrite = Math.min(CHUNK_SIZE, remaining);
52 const chunk = crypto.randomBytes(toWrite);
53 remaining -= toWrite;
54
55 if (!res.write(chunk)) {
56 // TCP backpressure - wait for drain
57 res.once('drain', sendChunk);
58 return;
59 }
60 }
61 res.end();
62 console.log(` [Server] Finished sending ${size} bytes`);
63 }
64
65 sendChunk();
66 });

Callers 1

createTestServerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected