<commit_before>var download = require('./download').download;
var spawn = require('child_process').spawn;
var path = require('path');
var fs = require('fs');

var ZMQ = '4.2.0';

function buildZMQ(scriptPath) {
  console.log('Building libzmq for ' + process.platform);

  var child = spawn(scriptPath, [ZMQ]);

  child.stdout.pipe(process.stdout);
  child.stderr.pipe(process.stderr);
  child.on('error', function(err) {
    console.error('Failed to start child process.');
  });
}

if (process.platform === 'win32') {
  var LIB_URL = 'https://github.com/nteract/libzmq-win/releases/download/v2.0.0/libzmq-' + ZMQ + '-' + process.arch + '.lib';
  var DIR_NAME = path.join(__dirname, '..', 'windows', 'lib');
  var FILE_NAME = path.join(DIR_NAME, 'libzmq.lib');

  if (!fs.existsSync(DIR_NAME)) {
    fs.mkdirSync(DIR_NAME);
  }

  if (!fs.existsSync(FILE_NAME)) {
    console.log('Downloading libzmq for Windows');
    download(LIB_URL, FILE_NAME, function() {
      console.log('Download finished');
    });
  }

} else {
  var SCRIPT_PATH = path.join(__dirname, 'build_libzmq.sh');
  var TAR_URL = 'https://github.com/zeromq/libzmq/releases/download/v' + ZMQ + '/zeromq-' + ZMQ + '.tar.gz';
  var DIR = path.join(__dirname, '..', 'zmq');
  var FILE_NAME = path.join(DIR, 'zeromq-' + ZMQ + '.tar.gz');

  if (!fs.existsSync(DIR)) {
    fs.mkdirSync(DIR);
  }

  if (fs.existsSync(FILE_NAME)) {
    buildZMQ(SCRIPT_PATH);
  } else {
    download(TAR_URL, FILE_NAME, function() {
      buildZMQ(SCRIPT_PATH);
    });
  }<commit_msg>Use libzmq 4.1.6 on linux Adresses #94 for now<commit_after>var download = require('./download').download;
var spawn = require('child_process').spawn;
var path = require('path');
var fs = require('fs');

var ZMQ;
var ZMQ_REPO;
if (process.platform == 'linux') {
  ZMQ = '4.1.6';
  ZMQ_REPO = 'zeromq4-1';
} else {
  ZMQ = '4.2.0';
  ZMQ_REPO = 'libzmq';
}

function buildZMQ(scriptPath) {
  console.log('Building libzmq for ' + process.platform);

  var child = spawn(scriptPath, [ZMQ]);

  child.stdout.pipe(process.stdout);
  child.stderr.pipe(process.stderr);
  child.on('error', function(err) {
    console.error('Failed to start child process.');
  });
}

if (process.platform === 'win32') {
  var LIB_URL = 'https://github.com/nteract/libzmq-win/releases/download/v2.0.0/libzmq-' + ZMQ + '-' + process.arch + '.lib';
  var DIR_NAME = path.join(__dirname, '..', 'windows', 'lib');
  var FILE_NAME = path.join(DIR_NAME, 'libzmq.lib');

  if (!fs.existsSync(DIR_NAME)) {
    fs.mkdirSync(DIR_NAME);
  }

  if (!fs.existsSync(FILE_NAME)) {
    console.log('Downloading libzmq for Windows');
    download(LIB_URL, FILE_NAME, function() {
      console.log('Download finished');
    });
  }

} else {
  var SCRIPT_PATH = path.join(__dirname, 'build_libzmq.sh');
  var TAR_URL = 'https://github.com/zeromq/' + ZMQ_REPO + '/releases/download/v' + ZMQ + '/zeromq-' + ZMQ + '.tar.gz';
  var DIR = path.join(__dirname, '..', 'zmq');
  var FILE_NAME = path.join(DIR, 'zeromq-' + ZMQ + '.tar.gz');

  if (!fs.existsSync(DIR)) {
    fs.mkdirSync(DIR);
  }

  if (fs.existsSync(FILE_NAME)) {
    buildZMQ(SCRIPT_PATH);
  } else {
    download(TAR_URL, FILE_NAME, function() {
      buildZMQ(SCRIPT_PATH);
    });
  }
{'fraction_non_alphanumeric': 0.18993205682520073, 'fraction_numerical': 0.008029647930821495, 'mean_word_length': 3.7353801169590644, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2447316', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1212, 'n_words': 221}