summaryrefslogtreecommitdiff
path: root/test/fixtures/stdio-filter.js
blob: cc0e53c39d035319338b5d79683e531be9f3093c (plain)
1
2
3
4
5
6
7
8
9
10
11
const util = require('util');

var regexIn = process.argv[2];
var replacement = process.argv[3];
var re = new RegExp(regexIn, 'g');
var stdin = process.openStdin();

stdin.on('data', function(data) {
  data = data.toString();
  process.stdout.write(data.replace(re, replacement));
});