MCPcopy Create free account
hub / github.com/middleapi/orpc / _streamToString

Function _streamToString

packages/standard-server-node/src/body.ts:120–131  ·  view source on GitHub ↗
(stream: Readable)

Source from the content-addressed store, hash-verified

118}
119
120async function _streamToString(stream: Readable): Promise<string> {
121 const decoder = new TextDecoder()
122 let text = ''
123
124 for await (const chunk of stream) {
125 text += decoder.decode(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk), { stream: true })
126 }
127
128 text += decoder.decode()
129
130 return text
131}
132
133async function _streamToFile(stream: Readable, fileName: string, contentType: string): Promise<File> {
134 const chunks: Buffer[] = []

Callers 1

toStandardBodyFunction · 0.85

Calls 1

decodeMethod · 0.65

Tested by

no test coverage detected