Skip to content

Instantly share code, notes, and snippets.

@ddnn55
Last active August 29, 2015 14:08
Show Gist options
  • Save ddnn55/f23596cc44b49229d043 to your computer and use it in GitHub Desktop.
Save ddnn55/f23596cc44b49229d043 to your computer and use it in GitHub Desktop.
minimal unix stdin line processor in NodeJS
#!/usr/bin/env node
var readline = require('readline');
var devnull = require('dev-null');
var rl = readline.createInterface({
input: process.stdin,
output: devnull()
});
rl.on('line', function(line) {
console.error('stdin line:', line);
});
rl.on('close', function() {
console.error('stdin ended.');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment