MCPcopy Create free account
hub / github.com/sindresorhus/execa / createWritable

Function createWritable

lib/convert/writable.js:14–29  ·  view source on GitHub ↗
({subprocess, concurrentStreams}, {to} = {})

Source from the content-addressed store, hash-verified

12
13// Create a `Writable` stream that forwards to `stdin` and awaits the subprocess
14export const createWritable = ({subprocess, concurrentStreams}, {to} = {}) => {
15 const {subprocessStdin, waitWritableFinal, waitWritableDestroy} = getSubprocessStdin(subprocess, to, concurrentStreams);
16 const writable = new Writable({
17 ...getWritableMethods(subprocessStdin, subprocess, waitWritableFinal),
18 destroy: callbackify(onWritableDestroy.bind(undefined, {
19 subprocessStdin,
20 subprocess,
21 waitWritableFinal,
22 waitWritableDestroy,
23 })),
24 highWaterMark: subprocessStdin.writableHighWaterMark,
25 objectMode: subprocessStdin.writableObjectMode,
26 });
27 onStdinFinished(subprocessStdin, writable, undefined, subprocess);
28 return writable;
29};
30
31// Retrieve `stdin` (or other stream depending on `to`)
32export const getSubprocessStdin = (subprocess, to, concurrentStreams) => {

Callers

nothing calls this directly

Calls 3

getSubprocessStdinFunction · 0.85
getWritableMethodsFunction · 0.85
onStdinFinishedFunction · 0.85

Tested by

no test coverage detected