(chunks: Uint8Array[], encoding: ExecEncoding)
| 453 | } |
| 454 | |
| 455 | function 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 | |
| 466 | function assertExecutionId(id: string) { |
| 467 | if (id.length === 0) throw new Error("Workspace runtime execution id must not be empty."); |
no test coverage detected