index.js
function transformAllFiles(transform, flush) {
  var files = [];

  return through.obj(
    function(file, enc, cb) {
      if (file.isStream()) {
        this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streams are not supported!'));
        return cb();
      }

      if (file.isBuffer()) {
        if (transform) transform.call(this, file, enc);
      }

      files.push(file);
      cb();
    },
    function(cb) {
      if (flush) files = flush.call(this, files);
      for (var i = 0; i < files.length; ++i) {
        this.push(files[i]);
      }
      cb();
    }
  );
}
function transformAllFiles(transform, flush) {
  var files = [];

  return through.obj(
    function(file, enc, cb) {
      if (file.isStream()) {
        this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streams are not supported!'));
        return cb();
      }

      if (file.isBuffer()) {
        if (transform) transform.call(this, file, enc);
      }

      files.push(file);
      cb();
    },
    function(cb) {
      if (flush) files = flush.call(this, files);
      for (var i = 0; i < files.length; ++i) {
        this.push(files[i]);
      }
      cb();
    }
  );
}
function transformAllFiles ( transform , flush ) { var files = [ ] ; return through . obj ( function ( file , enc , cb ) { if ( file . isStream ( ) ) { this . emit ( 'error' , new gutil . PluginError ( PLUGIN_NAME , 'Streams are not supported!' ) ) ; return cb ( ) ; } if ( file . isBuffer ( ) ) { if ( transform ) transform . call ( this , file , enc ) ; } files . push ( file ) ; cb ( ) ; } , function ( cb ) { if ( flush ) files = flush . call ( this , files ) ; for ( var i = 0 ; i < files . length ; ++ i ) { this . push ( files [ i ] ) ; } cb ( ) ; } ) ; }
Transform all files in the stream but wait until all files are handled before emitting events
Transform all files in the stream but wait until all files are handled before emitting events