MCPcopy Create free account
hub / github.com/cloudflare/computer / payloadBytes

Function payloadBytes

script/computerd-soak.mjs:198–208  ·  view source on GitHub ↗
(seed)

Source from the content-addressed store, hash-verified

196// compression ratio when it's enabled on the wire.
197const PAYLOAD_MODE = process.env.SOAK_PAYLOAD ?? "incompressible";
198function payloadBytes(seed) {
199 const out = new Uint8Array(PAYLOAD_B);
200 if (PAYLOAD_MODE === "text") {
201 const filler = `change ${seed} \u2014 the quick brown fox jumps over the lazy dog. `;
202 const bytes = new TextEncoder().encode(filler);
203 for (let i = 0; i < PAYLOAD_B; i++) out[i] = bytes[i % bytes.length];
204 } else {
205 for (let i = 0; i < PAYLOAD_B; i++) out[i] = (seed * 31 + i) & 0xff;
206 }
207 return out;
208}
209
210// Persistent capnweb WebSocket session against B. Reused
211// across the soak; one upgrade, many push round-trips.

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected