code: function readInput(cb, filename) {
  
      function readFile() {
        fs.readFile(filename, 'utf8', function (err, text) {
          if (err) {
            console.error("[ERROR] couldn't read from '" + filename + "':");
            console.error(err.message);
            return;
          }
  
          cb(err, text);
        });
      }
  
      function readStdin() {
        var text = ''
          , stdin = process.stdin
          ;
  
        stdin.resume();
  
        stdin.on('data', function (chunk) {
          text += chunk;
        });
  
        stdin.on('end', function () {
          cb(null, text);
        });
      }
  
      if (filename) {
        readFile();
      }
      else {
        readStdin();
      }
  
    }
docs: this could (and probably should) be its own module