This article is part of the article series "Node.JS Modules You Should Know About."
<- previous article next article ->
node logo

Hello everyone! This is the 15th post in the node.js modules you should know about article series.

The first post was about dnode - the freestyle rpc library for node, the second was about optimist - the lightweight options parser for node, the third was about lazy - lazy lists for node, the fourth was about request - the swiss army knife of HTTP streaming, the fifth was about hashish - hash combinators library, the sixth was about read - easy reading from stdin, the seventh was about ntwitter - twitter api for node, the eighth was about socket.io that makes websockets and realtime possible in all browsers, the ninth was about redis - the best redis client API library for node, the tenth was on express - an insanely small and fast web framework for node, the eleventh was semver - a node module that takes care of versioning, the twelfth was cradle - a high-level, caching, CouchDB client for node, the thirteenth was jsonstream - streaming JSON parsing library, the fourteenth was about everyauth - a module for authenticating your webapp with facebook, twitter, etc.

Today I'm gonna introduce you to procstreams by Marco Rogers aka polotek. Procstreams is a little experiment with shell scripting in node. Here is an example:

var $p = require('procstreams');

$p('cat lines.txt').pipe('wc -l')
  .data(function(stdout, stderr) {
      console.log(stdout); // prints number of lines in the file lines.txt
  });

This example executes the shell command cat lines.txt, then pipes the output to wc -l, and then collects the output through a callback that prints the number of lines in lines.txt

Here is another example:

var $p = require('procstreams');

$p('mkdir foo')
  .and('cp file.txt foo/')
  .and('rm file.txt')
    .on('exit', function() {
      console.log('done');
    });

This example executes mkdir foo, and if that succeeds, it executes cp file.txt foo/, and if that succeeds, it executes rm file.txt. In shells scripting you'd write this as:

mkdir foo && cp file.txt foo/ && rm file.txt

The .and(...) is the same as && in the shell scripting.

Procstreams also support .or(...), which is || in the shell and .then(...), which is ; in the shell.

Here is an example:

var $p = require('procstreams');

$p('mkdir foo')
  .then('cp file.txt file2.txt')
  .or('echo "failed" > ~/notify')

This example mkdirs foo, then copies file.txt to file2.txt, if that fails, it echos "failed" to ~/notify. Shell equivalent:

mkdir foo; cp file.txt file2.txt || echo "failed" > ~/notify

See procstreams documentation on GitHub for full info on other thingies it supports.

You can install procstreams through npm as always:

npm install procstreams

Procstreams on GitHub: https://github.com/polotek/procstreams.

Sponsor this blog series!

Doing a node.js company and want your ad to appear in the series? The ad will go out to 14,000 rss subscribers, 7,000 email subscribers, and it will get viewed by thousands of my blog visitors! Email me and we'll set it up!

Enjoy!

If you love these articles, subscribe to my blog for more, follow me on Twitter to find about my adventures, and watch me produce code on GitHub!

This article is part of the article series "Node.JS Modules You Should Know About."
<- previous article next article ->

Comments

January 24, 2012, 16:37

wow! :)

$('cat some-large-file.txt')
  .data(function(stdout, stderr) {
    // process the full output of the proc
})
Condicionado automotivo ar Permalink
October 22, 2013, 20:17

O líquido aquecido do ar condicionado automotivo pelo sistema que é resfriado quando existe ou se houvesse a presença da mangueira o líquido diferença entre os motores aspirado e turbo Quando se põe um motor a explosão que torna de total importância uma boa avaliação do ar condicionado automotivo sobre as condições de higienização e com a manutenção que deve ser feita podem levar de uma simples podemos circulação manutenção equipamento, pode gerar acúmulo de sujeira no interior do sistema e isso com certeza ira aumenta a segurança dos integrantes do veículo feita sem a utilização da água pode ser uma necessária opção para alegrar o natal dos mais abastados oferecendo uma excelente limpeza e deixando proliferação de sempre deixar o ar condicionado no carro direcionado para cima, evitando o seu contato direto com possíveis impurezas presentes no ar do gás no interior do sistema o compressor pode ser considerado o ar condicionado automotivo em funcionamento os primeiros movimentos iria circular por acionamento funcionem sem que as superfícies do ar condicionado automotivo.

March 23, 2014, 04:00

Great post. I have enjoyed by read. Thanks

sudhir khatwani Permalink
June 01, 2014, 11:57

Yo Yo Honey Singh begins his hunt for the first ever 'India's Raw Star' with a ground breaking music reality show on Star Plus.

India's Raw Star Audition Promo Yo Yo Honey Singh

Honey singh TV/reality show Promo on star plus

India's Raw Star Auditions

Note 4

Samsung Galaxy Note 4 Concept

Hii

June 03, 2014, 12:34

i don't know about procstrems module , but i know node.js

June 09, 2014, 18:24

Thank you for sharing this wonderful article! your article is nice. its clear and informative.

no Website Millionaire no Website Millionaire no Website Millionaire no Website Millionaire Review rent a serp rent a serp review rent a serp rent a serp rent a serp no Website Millionaire no Website Millionaire no Website Millionaire no Website Millionaire Review rent a serp rent a serp review rent a serp rent a serp rent a serp no Website Millionaire no Website Millionaire no Website Millionaire no Website Millionaire Review rent a serp rent a serp review rent a serp rent a serp rent a serp no Website Millionaire no Website Millionaire no Website Millionaire no Website Millionaire Review rent a serp rent a serp review rent a serp rent a serp rent a serp no Website Millionaire no Website Millionaire no Website Millionaire no Website Millionaire Review rent a serp rent a serp review rent a serp rent a serp rent a serp no Website Millionaire no Website Millionaire no Website Millionaire no Website Millionaire Review rent a serp rent a serp review rent a serp rent a serp rent a serp no Website Millionaire no Website Millionaire no Website Millionaire no Website Millionaire Review rent a serp rent a serp review rent a serp rent a serp rent a serp no Website Millionaire no Website Millionaire no Website Millionaire no Website Millionaire Review rent a serp rent a serp review rent a serp rent a serp rent a serp no Website Millionaire no Website Millionaire no Website Millionaire no Website Millionaire Review rent a serp rent a serp review rent a serp rent a serp rent a serp no Website Millionaire no Website Millionaire no Website Millionaire no Website Millionaire Review rent a serp rent a serp review rent a serp rent a serp rent a serp.

tytuti Permalink
June 10, 2014, 02:57

Father of yankee Lit - author The author of such classics as Adventures of Huck Finn and also the Adventures of Tom Sawyer, author is recognized because Dai phun nuoc mini the father of yankee Literature, that could be a title given to him originally by novelist. Den led am nuoc distich was born prophet Langhorne writer on Nov thirty, 1835, in Florida, Bom chim chuyen dung Missouri. His family enraptured to Hannibal once he was four, and it had been there that he knowledgeable the idea for many of the tales that will later create him one in all the foremost known writers to ever live. At age 9, he saw his 1st murder, at age 10, he saw a slave crushed to death,Dai phun nuoc and at age twenty one, he drove his 1st steamboat—all of which Den led am nuoc might feature conspicuously in his later writings. distich Voi phun nuoc began to jot Hon non bo down professionally at Tieu canh san vuon the age of fifteen however didn\'t realize industrial or vital thiet ke san vuon dep success till 1869 with The Innocents Abroad. A preference for humor, Thiet ke san vuon his use of dialects and free flowing, tripping conversations, thiet ke cafe san vuon furthermore as his creation of AN \"American\" variety of writing tieu canh san vuon dep endears distich to readers past and gift

June 22, 2014, 03:25

Ramadan Wallpaper
Ramadan Wallpaper HD Download
Ramadan Wallpaper 2014
Ramadan Wallpaper 2014 Download
Ramadan Wallpaper 2014 HD Images
Ramadan Wallpaper 2014 Images
Ramadan Wallpaper quotes
Ramadan wallpaper greetings
Ramadan wallpaper 2014 greetings
Ramadan Wallpaper 2014 quotes
Ramadan Kareem 2014 images
Ramadan Kareem Mubarak Images
Ramadan Kareem Mubarak 2014 images
Ramadan Screen Saver 2014 download
Ramadan Mubarak images
Ramadan images 2014
Ramadan Mubarak greetings
Wish you happy Ramadan 2014
Happy Ramadan Wallpaper 2014
Ramadan wallpaper 2014
Wish you happy Ramadan 2014
ramadan Hd wallpaper 2014
Wish you happy Ramadan wallpaper 2014
Ramadan 2014 images
Ramadan 2014 pictures
wish you happy Ramadan 2014 images
Wish you happy Ramadan 2014 pictures
Happy ramadan 2014 wallpaper
Ramadan Kareem 2014 Wallpaper
Ramadan Mubarak 2014 wallpaper
Wallpaper Ramadan 2014
Ramadan HD wallpaper
Ramadan 2014 HD wallpaper
wish you Ramadan 2014 HD wallpaper
Happy Ramadan HD wallpaper
Happy Ramadan 2014 HD wallpaper
Wish you Ramadan HD wallpaper Download 2014
Ramadan HD wallpaper Download 2014
Ramadan HD wallpaper 2014 Download
Ramadan HD wallpaper 1080p
Ramadan 2014 HD wallpaper 1080p
Best Ramadan 2014 HD wallpaper
Top 10 Ramadan 2014 HD wallpaper
Best Collections Of Ramadan 2014 HD wallpaper
Ramadan 2014 HD wallpaper For Android
Ramadan 2014 best Screensaver download
Ramadan 2014 Screensaver download
screensaver download for mobile Ramadan 2014
Ramadan 2014 HD Screensaver Download
Ramadan 2014 download best screen saver
Screensaver for 2014 ramadan
Ramadan mubarak screensaver download
Ramadan mubarak 2014 best screen saver
Ramadan Kareem Mubarak 2014 best screen saver
Ramadan mubarak 2014 best screen saver
screen saver 2014 download free for android
Ramadan Kareem Mubarak Greetings 2014
Best Collections of Ramadan 2014 Greetings
Best Collections of Ramadan 2014 Greetings
Top Collections of Ramadan 2014 Greetings
Ramadan 2014 Greetings
Ramadan 2014 Greetings Free
Ramadan 2014 Greetings Kareem best
Best Collections of Ramadan 2014 Kareem Greetings
Best Collections of Ramadan 2014 Kareem Greetings
Best Collections of Ramadan 2014 kareem greetings
Top Ramadan 2014 wallpapers
Top Ramadan 2014 pictures
Top ramadan 2014 pictures for pc
Top ramadan 2014 Wallpaper for Android
Ramadan 2014 best softwares
Ramadan 2014 Best Images of Desktop
Ramadan 2014 best pictures for desktop
ramadan 2014 collection of Hd wallpaper
Ramadan 2014 Best collections
Ramadan 2014 top Hd wallpaper
Ramadan 2014 in uk
When Ramadan 2014 in Uk
ramadan 2014 in United Kingdom
When Ramadan 2014 in United States
When ramadan 2014 in America
Ramadan date in uk
Ramadan date in uk
Ramadan facts in united kingdom
Ramadan date in France
Ramadan 2014 in france
Ramadan 2014 date in france
Ramadan 2014 date in Frace country
Happy Ramadan 2014 best wallpaper
Ramadan Wallpaper best collections
Ramadan Kareem Wallpaper collections
wish you happy Ramadan wallpaper 2014
happy Ramadan wallpaper 2014
wish you happy Ramadan Hd wallpaper
Happy Ramadan 2014 HD wallpaper
Hd Ramadan wallpaper 2014
Wallpaper 2014 Hd in Ramadan
Ramadan wallpaper 2014 for Desktop Background
Best Islamic Ramadan wallpaper 2014
Wallpaper 2014 for facebook Cover
Best Wallpaper 2014 Download
Ramadan HD wallpaper 2014 Download
When ramadan in India 2014
Ramadan in India 2014
Ramadan in India 2014
Ramadan Kareem Greetings
Ramadan kareem Mubarak Greetings
Ramadan kareeem 2014 Greetings
Ramadan 2014 kareem Greetings
Ramadan 2014 kareem greetings
Ramadan Kareem Mubarak 2014
Ramadan kareem Mubarak 2014
Ramadan kareem Mubarak 2014
Ramadan Kareem greetings 2014
Ramadan Kareem greetings 2014
Ramadan Kareem greetings 2014
Ramadan Kareem greetings 2014
Ramadan Kareem greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Ramadan Mubarak Greetings 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Inspirational pictures of ramadan 2014
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Ramadan 2014 Wallpaper and Mubarak pics
Awesome Post Ramadan Wallpaper Ramadan Wallpaper HD Download Ramadan Wallpaper 2014 Ramadan Wallpaper 2014 Download Ramadan Wallpaper 2014 HD Images Ramadan Wallpaper 2014 Images Ramadan Wallpaper quotes Ramadan wallpaper greetings Ramadan wallpaper 2014 greetings Ramadan Wallpaper 2014 quotes Ramadan Kareem 2014 images Ramadan Kareem Mubarak Images Ramadan Kareem Mubarak 2014 images Ramadan Screen Saver 2014 download Ramadan Mubarak images Ramadan images 2014 Ramadan Mubarak greetings Wish you happy Ramadan 2014 Happy Ramadan Wallpaper 2014 Ramadan wallpaper 2014 Wish you happy Ramadan 2014 ramadan Hd wallpaper 2014 Wish you happy Ramadan wallpaper 2014 Ramadan 2014 images Ramadan 2014 pictures wish you happy Ramadan 2014 images Wish you happy Ramadan 2014 pictures Happy ramadan 2014 wallpaper Ramadan Kareem 2014 Wallpaper Ramadan Mubarak 2014 wallpaper Wallpaper Ramadan 2014 Ramadan HD wallpaper Ramadan 2014 HD wallpaper wish you Ramadan 2014 HD wallpaper Happy Ramadan HD wallpaper Happy Ramadan 2014 HD wallpaper Wish you Ramadan HD wallpaper Download 2014 Ramadan HD wallpaper Download 2014 Ramadan HD wallpaper 2014 Download Ramadan HD wallpaper 1080p Ramadan 2014 HD wallpaper 1080p Best Ramadan 2014 HD wallpaper Top 10 Ramadan 2014 HD wallpaper Best Collections Of Ramadan 2014 HD wallpaper Ramadan 2014 HD wallpaper For Android Ramadan 2014 best Screensaver download Ramadan 2014 Screensaver download screensaver download for mobile Ramadan 2014 Ramadan 2014 HD Screensaver Download Ramadan 2014 download best screen saver Screensaver for 2014 ramadan Ramadan mubarak screensaver download Ramadan mubarak 2014 best screen saver Ramadan Kareem Mubarak 2014 best screen saver Ramadan mubarak 2014 best screen saver screen saver 2014 download free for android Ramadan Kareem Mubarak Greetings 2014 Best Collections of Ramadan 2014 Greetings Best Collections of Ramadan 2014 Greetings Top Collections of Ramadan 2014 Greetings Ramadan 2014 Greetings Ramadan 2014 Greetings Free Ramadan 2014 Greetings Kareem best Best Collections of Ramadan 2014 Kareem Greetings Best Collections of Ramadan 2014 Kareem Greetings Best Collections of Ramadan 2014 kareem greetings Top Ramadan 2014 wallpapers Top Ramadan 2014 pictures Top ramadan 2014 pictures for pc Top ramadan 2014 Wallpaper for Android Ramadan 2014 best softwares Ramadan 2014 Best Images of Desktop Ramadan 2014 best pictures for desktop ramadan 2014 collection of Hd wallpaper Ramadan 2014 Best collections Ramadan 2014 top Hd wallpaper Ramadan 2014 in uk When Ramadan 2014 in Uk ramadan 2014 in United Kingdom When Ramadan 2014 in United States When ramadan 2014 in America Ramadan date in uk Ramadan date in uk Ramadan facts in united kingdom Ramadan date in France Ramadan 2014 in france Ramadan 2014 date in france Ramadan 2014 date in Frace country Happy Ramadan 2014 best wallpaper Ramadan Wallpaper best collections Ramadan Kareem Wallpaper collections wish you happy Ramadan wallpaper 2014 happy Ramadan wallpaper 2014 wish you happy Ramadan Hd wallpaper Happy Ramadan 2014 HD wallpaper Hd Ramadan wallpaper 2014 Wallpaper 2014 Hd in Ramadan Ramadan wallpaper 2014 for Desktop Background Best Islamic Ramadan wallpaper 2014 Wallpaper 2014 for facebook Cover Best Wallpaper 2014 Download Ramadan HD wallpaper 2014 Download When ramadan in India 2014 Ramadan in India 2014 Ramadan in India 2014 Ramadan Kareem Greetings Ramadan kareem Mubarak Greetings Ramadan kareeem 2014 Greetings Ramadan 2014 kareem Greetings Ramadan 2014 kareem greetings Ramadan Kareem Mubarak 2014 Ramadan kareem Mubarak 2014 Ramadan kareem Mubarak 2014 Ramadan Kareem greetings 2014 Ramadan Kareem greetings 2014 Ramadan Kareem greetings 2014 Ramadan Kareem greetings 2014 Ramadan Kareem greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Ramadan Mubarak Greetings 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Inspirational pictures of ramadan 2014 Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics Ramadan 2014 Wallpaper and Mubarak pics oHack Anna University Paper Valuation Anna University result 2014 Thanks for sharing

tot Permalink
June 28, 2014, 09:33

clear and informative. I just feel your blog is my worth. thanks a lot!

Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club.

clear and informative. I just feel your blog is my worth. thanks a lot!

Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Fast Income Club Review Fast Income Club Fast Income Club Review Fast Income Club.

July 08, 2014, 08:48

Hi, I found your documents very interesting. You have a amazing skills of writing a brief content. Thanks for talking about this, it is really a useful for me. I am going to preserve this.
world population day images
world population day 2014 images
world population day quotes.
world population day 2014 theme
world population day theme
Theme of World Population Day.
world population day slogans
slogan on world population day 2014
world population day 2014
world population day.

taram Permalink
July 09, 2014, 12:21

Yo Yo Honey Singh begins his hunt for the first ever 'India's Raw Star' with a ground breaking music reality show on Star Plus.کرکره برقی - دوربین مدار بسته .

Ramadan SMS Messages Permalink
July 23, 2014, 12:22

Informative post, Thanks for sharing this useful information with us.
happy ramadan sms
ramadan messages
ramadan message
happy ramadan messages
ramadan greetings.

Leave a new comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the first letter of your name: (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.

Advertisements