bin/cli.js
function Aggregator(withTable) {
  var firstline = !!withTable;

  var aggregator = new stream.Transform({ objectMode: true, highWaterMark: 100 });
  aggregator.records = [];

  aggregator._transform = function(record, enc, callback) {
    if (!record) return;
    if (firstline) {
      firstline = false;
      this.push(record);
    } else if (aggregator.records.length === 25) {
      this.push(aggregator.records);
      aggregator.records = [record];
    } else {
      aggregator.records.push(record);
    }
    callback();
  };

  aggregator._flush = function(callback) {
    if (aggregator.records.length) this.push(aggregator.records);
    callback();
  };

  return aggregator;
}
function Aggregator(withTable) {
  var firstline = !!withTable;

  var aggregator = new stream.Transform({ objectMode: true, highWaterMark: 100 });
  aggregator.records = [];

  aggregator._transform = function(record, enc, callback) {
    if (!record) return;
    if (firstline) {
      firstline = false;
      this.push(record);
    } else if (aggregator.records.length === 25) {
      this.push(aggregator.records);
      aggregator.records = [record];
    } else {
      aggregator.records.push(record);
    }
    callback();
  };

  aggregator._flush = function(callback) {
    if (aggregator.records.length) this.push(aggregator.records);
    callback();
  };

  return aggregator;
}
function Aggregator ( withTable ) { var firstline = ! ! withTable ; var aggregator = new stream . Transform ( { objectMode : true , highWaterMark : 100 } ) ; aggregator . records = [ ] ; aggregator . _transform = function ( record , enc , callback ) { if ( ! record ) return ; if ( firstline ) { firstline = false ; this . push ( record ) ; } else if ( aggregator . records . length === 25 ) { this . push ( aggregator . records ) ; aggregator . records = [ record ] ; } else { aggregator . records . push ( record ) ; } callback ( ) ; } ; aggregator . _flush = function ( callback ) { if ( aggregator . records . length ) this . push ( aggregator . records ) ; callback ( ) ; } ; return aggregator ; }
Transform stream that aggregates into sets of 25 objects
Transform stream that aggregates into sets of 25 objects