MCPcopy Create free account
hub / github.com/cameri/nostream / toBuffer

Function toBuffer

test/unit/utils/compression.spec.ts:30–38  ·  view source on GitHub ↗
(stream: NodeJS.ReadableStream)

Source from the content-addressed store, hash-verified

28}
29
30const toBuffer = async (stream: NodeJS.ReadableStream): Promise<Buffer> => {
31 const chunks: Buffer[] = []
32
33 for await (const chunk of stream as AsyncIterable<Buffer | string>) {
34 chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk))
35 }
36
37 return Buffer.concat(chunks)
38}
39
40const expectStreamToFail = async (stream: NodeJS.ReadableStream): Promise<void> => {
41 try {

Callers 2

expectStreamToFailFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected