Skip to content

Instantly share code, notes, and snippets.

@hubgit
Created June 17, 2020 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hubgit/70e7d538fcbcf43cb2dc2fef3b992139 to your computer and use it in GitHub Desktop.
Save hubgit/70e7d538fcbcf43cb2dc2fef3b992139 to your computer and use it in GitHub Desktop.
Pipe input to a promisified execFile command
const promise = promisify(execFile)('foo', {
encoding: 'buffer', // remove this to get the output as a string
})
promise.child.stdin.write(input)
promise.child.stdin.end()
const { stdout: output } = await promise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment