Skip to content

Instantly share code, notes, and snippets.

@alanmquach
Last active August 29, 2015 14:12
Show Gist options
  • Save alanmquach/cd6de4d06c0c985693b6 to your computer and use it in GitHub Desktop.
Save alanmquach/cd6de4d06c0c985693b6 to your computer and use it in GitHub Desktop.
Process unix streams with a node script
#!/usr/bin/env node
// $ echo "madam im adam" | ./plumber.js
require('readline').createInterface({
input: process.stdin,
terminal: false
}).on('line', function(line){
process.stdout.write(line.split("").reverse().join("") + '\n');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment