<commit_before>'use strict';

var filename = require('filename.js');
var Promise = require('bluebird');

module.exports = function imageProcessor(image) {
  return function processImageToWidth(width, suffix) {
    var params = {
      srcPath: '-',
      srcData: image.data,
      srcFormat: image.type,
      width: width,
      dstPath: '-',
      format: image.type
    };

    var imagemagick = require('imagemagick');
    return new Promise(function(resolve, reject) {
      imagemagick.resize(params, function(error, stdout, stderr) {
        if (error || stderr) {
          return reject('imagemagick error: ' + (error || stderr));
        }
        var suffixes = ['w' + width];
        if (suffix) {
          suffixes.push(suffix);
        }
        resolve({
          key: filename.appendSuffix(suffixes, image.key),
          data: stdout,
          type: image.type
        });
      });
    });
  };
};
<commit_msg>More debugging<commit_after>'use strict';

/* eslint-disable no-console */

var filename = require('filename.js');
var Promise = require('bluebird');

module.exports = function imageProcessor(image) {
  return function processImageToWidth(width, suffix) {
    console.log(width, suffix);
    var params = {
      srcPath: '-',
      srcData: image.data,
      srcFormat: image.type,
      width: width,
      dstPath: '-',
      format: image.type
    };

    var imagemagick = require('imagemagick');
    console.log('imagemagick');
    return new Promise(function(resolve, reject) {
      console.log('resize');
      imagemagick.resize(params, function(error, stdout, stderr) {
        console.log(error);
        console.log(stderr);
        if (error || stderr) {
          return reject('imagemagick error: ' + (error || stderr));
        }
        console.log('no errors');
        var suffixes = ['w' + width];
        if (suffix) {
          suffixes.push(suffix);
        }
        console.log(suffixes);
        resolve({
          key: filename.appendSuffix(suffixes, image.key),
          data: stdout,
          type: image.type
        });
      });
    });
  };
};

{'fraction_non_alphanumeric': 0.14150496923805017, 'fraction_numerical': 0.0, 'mean_word_length': 2.318681318681319, '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': '1656151', 'n_tokens_mistral': 636, 'n_tokens_neox': 625, 'n_words': 134}