<commit_before>var es = require('event-stream');
var os = require('os');
var path = require('path');
var gutil = require('gulp-util');

module.exports = function(fileName, opt){
  if (!fileName) throw new Error("Missing fileName option for gulp-concat");
  if (!opt) opt = {};
  if (!opt.newLine) opt.newLine = os.EOL;
  
  var buffer = [];
  function bufferContents(file){
    // clone the file so we arent mutating stuff
    buffer.push(file);
  }

  function endStream(){
    if (buffer.length === 0) return this.emit('end');

    var joinedContents = buffer.map(function(file){
      return file.contents;
    }).join(opt.newLine);

    var joinedPath = path.join(buffer[0].base, fileName);

    var joinedFile = new gutil.File({
      cwd: buffer[0].cwd,
      base: buffer[0].base,
      path: joinedPath,
      contents: joinedContents
    });

    this.emit('data', joinedFile);
    this.emit('end');<commit_msg>Need to buffer file contents<commit_after>var es = require('event-stream');
var os = require('os');
var path = require('path');
var gutil = require('gulp-util');

module.exports = function(fileName, opt){
  if (!fileName) throw new Error("Missing fileName option for gulp-concat");
  if (!opt) opt = {};
  if (!opt.newLine) opt.newLine = os.EOL;
  
  var buffer = [];
  function bufferContents(file){
    // clone the file so we arent mutating stuff
    buffer.push(file);
  }

  function endStream(){
    if (buffer.length === 0) return this.emit('end');

    var joinedContents = buffer.map(function(file){
      return file.contents;
    }).join(opt.newLine);

    var joinedPath = path.join(buffer[0].base, fileName);

    var joinedFile = new gutil.File({
      cwd: buffer[0].cwd,
      base: buffer[0].base,
      path: joinedPath,
      contents: new Buffer(joinedContents)
    });

    this.emit('data', joinedFile);
    this.emit('end');
{'fraction_non_alphanumeric': 0.15640064274236742, 'fraction_numerical': 0.004284949116229245, 'mean_word_length': 3.4265402843601898, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7668263', 'n_tokens_mistral': 592, 'n_tokens_neox': 587, 'n_words': 156}