Skip to content

Instantly share code, notes, and snippets.

@jameswomack
Created December 3, 2017 22:54
Show Gist options
  • Select an option

  • Save jameswomack/af7abc669de71589b200a8bb22631b40 to your computer and use it in GitHub Desktop.

Select an option

Save jameswomack/af7abc669de71589b200a8bb22631b40 to your computer and use it in GitHub Desktop.
Accept Unix pipes w/ Node.js & pure CLI coding
echo 'foo' | node -e "let data='';process.stdin.isTTY?console.info(process.argv):process.stdin.on('readable',()=>{data+=process.stdin.read()||''}).on('end',()=>console.info(data.trim()))"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment