tasks/localhosts.js
function (lines, cb) {
    fs.stat(HOSTS, function (err, stat) {
      if (err) {
        cb(err);
      } else {
        var s = fs.createWriteStream(HOSTS, { mode: stat.mode });
        s.on('close', cb);
        s.on('error', cb);

        lines.forEach(function (line, lineNum) {
          if (Array.isArray(line)) {
            line = line[0] + ' ' + line[1];
          }
          s.write(line + (lineNum === lines.length - 1 ? '' : EOL));
        });
        s.end();
      }
    });
  }
function (lines, cb) {
    fs.stat(HOSTS, function (err, stat) {
      if (err) {
        cb(err);
      } else {
        var s = fs.createWriteStream(HOSTS, { mode: stat.mode });
        s.on('close', cb);
        s.on('error', cb);

        lines.forEach(function (line, lineNum) {
          if (Array.isArray(line)) {
            line = line[0] + ' ' + line[1];
          }
          s.write(line + (lineNum === lines.length - 1 ? '' : EOL));
        });
        s.end();
      }
    });
  }
function ( lines , cb ) { fs . stat ( HOSTS , function ( err , stat ) { if ( err ) { cb ( err ) ; } else { var s = fs . createWriteStream ( HOSTS , { mode : stat . mode } ) ; s . on ( 'close' , cb ) ; s . on ( 'error' , cb ) ; lines . forEach ( function ( line , lineNum ) { if ( Array . isArray ( line ) ) { line = line [ 0 ] + ' ' + line [ 1 ] ; } s . write ( line + ( lineNum === lines . length - 1 ? '' : EOL ) ) ; } ) ; s . end ( ) ; } } ) ; }
Write out an array of lines to the host file. Assumes that they're in the
format that `get` returns.

@param  {Array.<string|Array.<string>>} lines
@param  {function(Error)} cb
Write out an array of lines to the host file . Assumes that they re in the format that get returns .