code: function(arrRes) {
    var isPrint = argv["p"];
    var isFile = argv["f"];
  
    if (isPrint) {
      console.log(arrRes.join("\n"));
    }
  
    else if (isFile) {
      var ws = fs.createWriteStream("spritelist.txt");
      var write = function(i) {
        ws.write(arrRes[i] + "\n", function(err) {
          if (err) {
            return console.log(err);
          }
  
          i++;
  
          if (i < arrRes.length) {
            write(i);
          } else {
            console.log("spritelist finished!");
          }
        });
      };
      write(0);
    }
  
    else {
      var IS_WIN = process.platform.indexOf('win') === 0;
      var escapeShellArg = function(cmd) {
        return '"' + cmd + '"';
      };
      var openUrl = function(path, callback){
        var child_process = require("child_process");
        var cmd = escapeShellArg(path);
        if(IS_WIN){
          cmd = 'start "" ' + cmd;
        }else{
          if(process.env["XDG_SESSION_COOKIE"] ||
             process.env["XDG_CONFIG_DIRS"] ||
             process.env["XDG_CURRENT_DESKTOP"]){
            cmd = "xdg-open " + cmd
          }else if(process.env["GNOME_DESKTOP_SESSION_ID"]){
            cmd = 'gnome-open ' + cmd;
          }else{
            cmd = "open " + cmd;
          }
        }
        child_process.exec(cmd, callback);
      };
  
      var server = http.createServer(function(request, response) {
        try {
          response.end(arrRes.join("\n"));
        } catch (err) {
          response.end(err.toString());
        }finally{
          process.exit()
        }
      });
  
      server.listen(9009);
  
      openUrl("http://127.0.0.1:9009", function(err){
        if(err){
          server.close();
          return console.log(err);
        }
      });
  
    }
  }
docs: 定义输出结果