MCPcopy Index your code
hub / github.com/simstudioai/sim / streamResponse

Function streamResponse

apps/sim/connectors/utils.test.ts:1147–1162  ·  view source on GitHub ↗
(chunks: Uint8Array[], onCancel?: () => void)

Source from the content-addressed store, hash-verified

1145})
1146
1147function streamResponse(chunks: Uint8Array[], onCancel?: () => void): Response {
1148 let index = 0
1149 const stream = new ReadableStream<Uint8Array>({
1150 pull(controller) {
1151 if (index < chunks.length) {
1152 controller.enqueue(chunks[index++])
1153 } else {
1154 controller.close()
1155 }
1156 },
1157 cancel() {
1158 onCancel?.()
1159 },
1160 })
1161 return new Response(stream)
1162}
1163
1164describe('readBodyWithLimit', () => {
1165 it('returns the full buffer when the streamed body is within the cap', async () => {

Callers 1

utils.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected