You can pipe into Node.js (#tilPost)

In July 2017 I wrote about ways to execute JavaScript snippets from your clipboard using process substitution. The snippet that I’m using since then to execute JavaScript snippets quickly is the following…
$ node <(pbpaste)

To…


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis

In July 2017 I wrote about ways to execute JavaScript snippets from your clipboard using process substitution. The snippet that I'm using since then to execute JavaScript snippets quickly is the following...

$ node <(pbpaste)

Today I came across a tweet by Julian Gruber and it turns out you use the pipe operator with the Node.js binary directly.

$ pbpaste | node

The result is the same but it looks nicer and feels better that using process substituion (<(...)). I have no idea how I missed this Node.js detail and checked the previous versions of Node.js and it works going down to Node.js v4 (that's what I have available on my machine). Good to know!


Reply to Stefan


This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis


Print Share Comment Cite Upload Translate Updates
APA

Stefan Judis | Sciencx (2018-09-22T22:00:00+00:00) You can pipe into Node.js (#tilPost). Retrieved from https://www.scien.cx/2018/09/22/you-can-pipe-into-node-js-tilpost/

MLA
" » You can pipe into Node.js (#tilPost)." Stefan Judis | Sciencx - Saturday September 22, 2018, https://www.scien.cx/2018/09/22/you-can-pipe-into-node-js-tilpost/
HARVARD
Stefan Judis | Sciencx Saturday September 22, 2018 » You can pipe into Node.js (#tilPost)., viewed ,<https://www.scien.cx/2018/09/22/you-can-pipe-into-node-js-tilpost/>
VANCOUVER
Stefan Judis | Sciencx - » You can pipe into Node.js (#tilPost). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2018/09/22/you-can-pipe-into-node-js-tilpost/
CHICAGO
" » You can pipe into Node.js (#tilPost)." Stefan Judis | Sciencx - Accessed . https://www.scien.cx/2018/09/22/you-can-pipe-into-node-js-tilpost/
IEEE
" » You can pipe into Node.js (#tilPost)." Stefan Judis | Sciencx [Online]. Available: https://www.scien.cx/2018/09/22/you-can-pipe-into-node-js-tilpost/. [Accessed: ]
rf:citation
» You can pipe into Node.js (#tilPost) | Stefan Judis | Sciencx | https://www.scien.cx/2018/09/22/you-can-pipe-into-node-js-tilpost/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.