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

Function join

packages/computer/src/runtime/runtime.ts:455–464  ·  view source on GitHub ↗
(chunks: Uint8Array[], encoding: ExecEncoding)

Source from the content-addressed store, hash-verified

453}
454
455function join(chunks: Uint8Array[], encoding: ExecEncoding): string | Uint8Array {
456 const size = chunks.reduce((total, chunk) => total + chunk.byteLength, 0);
457 const bytes = new Uint8Array(size);
458 let offset = 0;
459 for (const chunk of chunks) {
460 bytes.set(chunk, offset);
461 offset += chunk.byteLength;
462 }
463 return encoding === "utf8" ? new TextDecoder().decode(bytes) : bytes;
464}
465
466function assertExecutionId(id: string) {
467 if (id.length === 0) throw new Error("Workspace runtime execution id must not be empty.");

Callers 6

walkDiskFunction · 0.85
toHostPathFunction · 0.85
drainModuleResultFunction · 0.85
mainFunction · 0.85

Calls 1

setMethod · 0.65

Tested by

no test coverage detected