MCPcopy
hub / github.com/imcuttle/mometa / concatStringPromise

Function concatStringPromise

packages/editor/webpack/create-server.js:19–30  ·  view source on GitHub ↗
(req)

Source from the content-addressed store, hash-verified

17}
18
19const concatStringPromise = (req) => {
20 return new Promise((res, rej) => {
21 let data = []
22 req.on('data', (chunk) => {
23 data.push(chunk)
24 })
25 req.on('end', () => {
26 res(Buffer.concat(data).toString('utf-8'))
27 })
28 req.on('error', rej)
29 })
30}
31
32const json = async (req) => {
33 const string = await concatStringPromise(req)

Callers 1

jsonFunction · 0.85

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected