<commit_before>const path = require('path');
const exec = require('child_process').exec;
const phantomjs = require('phantomjs');
const fs = require('fs');
const phantomBinPath = phantomjs.path;

function makeTmpDirectory() {
  const tmpPath = path.resolve('./tmp/');
  fs.mkdir(tmpPath, (err) => {
    if (err && err.code != 'EEXIST') {
      throw err;
    }
  });

  return tmpPath;
}

function spawnConverterFromFile(dataSourceFile) {
  const command = `${phantomBinPath} ${path.join(__dirname, '../bin/fusioncharts2svg.js')} ${dataSourceFile}`;

  const deferred = Promise.defer();
  exec(command, (err, stdout, stderr) => {
    if (err) deferred.reject(err);
    else if (stderr) deferred.reject(stderr);

    deferred.resolve(stdout);
  });

  return deferred.promise;
}

function spawnConverterFromObject(dataSource) {
  const tmpPath = makeTmpDirectory();
  const tmpFileName = `${tmpPath}/${Date.now()}.json`;
  fs.writeFileSync(tmpFileName, JSON.stringify(dataSource));

  return spawnConverterFromFile(tmpFileName).then((svg) => {
    fs.unlinkSync(tmpFileName);
    return svg;
  });
}

module.exports.fromFile = spawnConverterFromFile;
module.exports.fromObject = spawnConverterFromObject;
<commit_msg>[modify] modify maxbuffer size of stdout<commit_after>const path = require('path');
const exec = require('child_process').exec;
const phantomjs = require('phantomjs');
const fs = require('fs');
const phantomBinPath = phantomjs.path;
const maxBuffer = 1024 * 1024 * 100;

function makeTmpDirectory() {
  const tmpPath = path.resolve('./tmp/');
  fs.mkdir(tmpPath, (err) => {
    if (err && err.code != 'EEXIST') {
      throw err;
    }
  });

  return tmpPath;
}

function spawnConverterFromFile(dataSourceFile) {
  const command = `${phantomBinPath} ${path.join(__dirname, '../bin/fusioncharts2svg.js')} ${dataSourceFile}`;

  const deferred = Promise.defer();
  exec(command, { maxBuffer: maxBuffer }, (err, stdout, stderr) => {
    if (err) deferred.reject(err);
    else if (stderr) deferred.reject(stderr);

    deferred.resolve(stdout);
  });

  return deferred.promise;
}

function spawnConverterFromObject(dataSource) {
  const tmpPath = makeTmpDirectory();
  const tmpFileName = `${tmpPath}/${Date.now()}.json`;
  fs.writeFileSync(tmpFileName, JSON.stringify(dataSource));

  return spawnConverterFromFile(tmpFileName).then((svg) => {
    fs.unlinkSync(tmpFileName);
    return svg;
  });
}

module.exports.fromFile = spawnConverterFromFile;
module.exports.fromObject = spawnConverterFromObject;

{'fraction_non_alphanumeric': 0.15317460317460319, 'fraction_numerical': 0.005158730158730159, 'mean_word_length': 4.862790697674418, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1983990', 'n_tokens_mistral': 828, 'n_tokens_neox': 781, 'n_words': 160}