Last active
August 29, 2015 14:12
-
-
Save alanmquach/cd6de4d06c0c985693b6 to your computer and use it in GitHub Desktop.
Process unix streams with a node script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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