<commit_before>/**
 *
 * Copyright(c) 2012 <NAME> <<EMAIL>>
 * MIT LICENSE
 *
 */

var connect = require('connect'),
    path = require('path'),
    spawn = require('child_process').spawn,
    credentials = require('./lib/credentials'),
    fs = require('fs'),
    app, upPath;

upPath = path.join(__dirname, 'upload');

path.exists(upPath,
  function(exists) {
    if(!exists) {
      fs.mkdir(upPath,
        function(err) {
          if(err) console.log(err);
        });
    }
  });

app = connect()
  .use(connect.static(path.join(__dirname, 'public')))
  .use(credentials())
  .use(connect.multipart({ uploadDir: upPath }))
  .use(
    function(req, res) {

      if(req.files.hasOwnProperty('upload')) {
        var file = req.files.upload,
            unzip = spawn('unzip', ['-o', '-d', path.join(__dirname, 'public'), file.path]);

        unzip.stdout.on('data',
          function (data) {
            //console.log(data);
          });

        unzip.stderr.on('data',
          function (data) {
            //console.log(data);
          });

        unzip.on('exit',
          function (code) {
            if(code !== 0) {
              console.log('Something happened.');
              res.end('failed');
            } else {
              console.log('Completed upload.');
              res.end('success');

              // Cleanup the files
              fs.unlink(file.path,
                function(err) {
                  if(err) console.log(err);
                });
            }
          });
      }
    }).listen(3055);<commit_msg>Missed a dir<commit_after>/**
 *
 * Copyright(c) 2012 <NAME> <<EMAIL>>
 * MIT LICENSE
 *
 */

var connect = require('connect'),
    path = require('path'),
    spawn = require('child_process').spawn,
    credentials = require('./lib/credentials'),
    fs = require('fs'),
    app, upPath, pubPath;

upPath = path.join(__dirname, 'upload');
pubPath = path.join(__dirname, 'public');

path.exists(upPath,
  function(exists) {
    if(!exists) {
      fs.mkdir(upPath,
        function(err) {
          if(err) console.log(err);
        });
    }
  });

path.exists(pubPath,
  function(exists) {
    if(!exists) {
      fs.mkdir(pubPath,
        function(err) {
          if(err) console.log(err);
        });
    }
  });

app = connect()
  .use(connect.static(pubPath))
  .use(credentials())
  .use(connect.multipart({ uploadDir: upPath }))
  .use(
    function(req, res) {

      if(req.files.hasOwnProperty('upload')) {
        var file = req.files.upload,
            unzip = spawn('unzip', ['-o', '-d', path.join(__dirname, 'public'), file.path]);

        unzip.stdout.on('data',
          function (data) {
            //console.log(data);
          });

        unzip.stderr.on('data',
          function (data) {
            //console.log(data);
          });

        unzip.on('exit',
          function (code) {
            if(code !== 0) {
              console.log('Something happened.');
              res.end('failed');
            } else {
              console.log('Completed upload.');
              res.end('success');

              // Cleanup the files
              fs.unlink(file.path,
                function(err) {
                  if(err) console.log(err);
                });
            }
          });
      }
    }).listen(3055);
{'fraction_non_alphanumeric': 0.17420132610006028, 'fraction_numerical': 0.0054249547920434, 'mean_word_length': 1.752072968490879, 'pattern_counts': {'":': 0, '<': 9, '<?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': '1582653', 'n_tokens_mistral': 1032, 'n_tokens_neox': 1008, 'n_words': 171}