MCPcopy
hub / github.com/simstudioai/sim / toWebStream

Function toWebStream

apps/sim/lib/core/utils/multipart.test.ts:28–41  ·  view source on GitHub ↗
(body: Buffer, chunkSize?: number)

Source from the content-addressed store, hash-verified

26}
27
28function toWebStream(body: Buffer, chunkSize?: number): ReadableStream<Uint8Array> {
29 return new ReadableStream<Uint8Array>({
30 start(controller) {
31 if (chunkSize) {
32 for (let i = 0; i < body.length; i += chunkSize) {
33 controller.enqueue(new Uint8Array(body.subarray(i, i + chunkSize)))
34 }
35 } else {
36 controller.enqueue(new Uint8Array(body))
37 }
38 controller.close()
39 },
40 })
41}
42
43function makeRequest(
44 parts: Part[],

Callers 2

makeRequestFunction · 0.85
multipart.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected