MCPcopy Index your code
hub / github.com/angular/dev-infra / readBufferFromStdinUntilClosed

Function readBufferFromStdinUntilClosed

ng-dev/utils/read-stdin-until-closed.ts:18–29  ·  view source on GitHub ↗
(
  input: NodeJS.ReadStream = process.stdin,
)

Source from the content-addressed store, hash-verified

16 * on unexpected read errors.
17 */
18export function readBufferFromStdinUntilClosed(
19 input: NodeJS.ReadStream = process.stdin,
20): Promise<Buffer> {
21 return new Promise((resolve, reject) => {
22 const data: Buffer[] = [];
23
24 input.on('data', (chunk) => data.push(chunk));
25 input.on('end', () => resolve(Buffer.concat(data)));
26 input.on('error', () => reject(new ReadBufferFromStdinError()));
27 input.on('timeout', () => reject(new ReadBufferFromStdinError('Unexpected timeout')));
28 });
29}

Callers 1

handlerFunction · 0.85

Calls 3

resolveFunction · 0.85
onMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected