<commit_before>'use strict';

// error code:
// 1 : datastore error
// 2 : image manipulation error


var defaultAvatarSize = 128;
var logger = require('..').logger;
var PassThrough = require('stream').PassThrough;
var gm = require('gm');
var filestore = require('..').filestore;
var async = require('async');

function getDuplicates(readable) {
  var p1 = new PassThrough();
  var p2 = new PassThrough();
  readable.pipe(p1);
  readable.pipe(p2);
  return [p1, p2];
}

function getSize(readable, callback) {
  gm(readable)
  .size({bufferStream: true}, function(err, size) {
    if (err) {
      logger.error('Failed to get image size');
      logger.debug(err);
      err.code = 2;
      return callback(err);
    }
    return callback(null, size, this);
  });<commit_msg>OR-221 gm should use imageMagick in the image module<commit_after>'use strict';

// error code:
// 1 : datastore error
// 2 : image manipulation error


var defaultAvatarSize = 128;
var logger = require('..').logger;
var PassThrough = require('stream').PassThrough;
var gm = require('gm').subClass({ imageMagick: true });
var filestore = require('../filestore');
var async = require('async');

function getDuplicates(readable) {
  var p1 = new PassThrough();
  var p2 = new PassThrough();
  readable.pipe(p1);
  readable.pipe(p2);
  return [p1, p2];
}

function getSize(readable, callback) {
  gm(readable)
  .size({bufferStream: true}, function(err, size) {
    if (err) {
      logger.error('Failed to get image size');
      logger.debug(err);
      err.code = 2;
      return callback(err);
    }
    return callback(null, size, this);
  });
{'fraction_non_alphanumeric': 0.15503397158739962, 'fraction_numerical': 0.016676961087090797, 'mean_word_length': 3.736842105263158, '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': '2104260', 'n_tokens_mistral': 560, 'n_tokens_neox': 519, 'n_words': 146}