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

module.exports = function(pipeMap, config, rootPath) {

  return es.map(function(file, cb) {
    // Rewrite path to be relative from the rootPath
    file.path = path.relative(rootPath, file.path);

    var pipes = utils.pipesForFileExtensions(path.basename(file.path), pipeMap, config);

    if(pipes.length == 0) {
      cb(null, file);
      return;
    }

    console.log(
      '      ',
      gutil.colors.yellow(file.path),
      '=>', 
      pipes.map(function(pipe){ return pipe.name; }).join(' -> '));

    var stream = utils.createFromStream(file);
    stream = utils.applyPipes(stream, pipes);

    stream.on('data', function(newFile){
      cb(null, newFile);
    });

  });

};<commit_msg>Replace leftover gutil instance<commit_after>var path = require('path');
var es = require('event-stream');
var utils = require('./utils');
var chalk = require('chalk');

module.exports = function(pipeMap, config, rootPath) {

  return es.map(function(file, cb) {
    // Rewrite path to be relative from the rootPath
    file.path = path.relative(rootPath, file.path);

    var pipes = utils.pipesForFileExtensions(path.basename(file.path), pipeMap, config);

    if(pipes.length == 0) {
      cb(null, file);
      return;
    }

    console.log(
      '      ',
      chalk.yellow(file.path),
      '=>',
      pipes.map(function(pipe){ return pipe.name; }).join(' -> '));

    var stream = utils.createFromStream(file);
    stream = utils.applyPipes(stream, pipes);

    stream.on('data', function(newFile){
      cb(null, newFile);
    });

  });

};
{'fraction_non_alphanumeric': 0.16588235294117648, 'fraction_numerical': 0.001176470588235294, 'mean_word_length': 3.1386861313868613, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2094060', 'n_tokens_mistral': 567, 'n_tokens_neox': 544, 'n_words': 115}