<commit_before>var express = require('express');
var Busboy = require('busboy');
var path = require('path');
var cors = require('cors');
var fs = require('fs');
var streams = require('memory-streams');

var app = express();

var whitelist = ['http://valor-software.github.io/ng2-file-upload/', 'http://localhost:8080'];

var corsOptionsDelegate = function(req, callback){
  var corsOptions;
  if(whitelist.indexOf(req.header('Origin')) !== -1){
    corsOptions = { origin: true }; // reflect (enable) the requested origin in the CORS response
  }else{
    corsOptions = { origin: false }; // disable CORS for this request
  }
  callback(null, corsOptions); // callback expects two parameters: error and options
};

app.get('/', function (req, res) {
  res.end('Ok!');
});

app.post('/api', cors(corsOptionsDelegate), function (req, res) {
  var fstream;
  var files = [];
  var busboy = new Busboy({headers: req.headers});
  busboy.on('file', function (fieldname, file, filename) {
    // fstream = fs.createWriteStream(__dirname + '/uploads/' + filename);
    // stub<commit_msg>Updated: path fix<commit_after>var express = require('express');
var Busboy = require('busboy');
var path = require('path');
var cors = require('cors');
var fs = require('fs');
var streams = require('memory-streams');

var app = express();

var whitelist = ['http://valor-software.github.io/ng2-file-upload', 'http://localhost:8080'];

var corsOptionsDelegate = function(req, callback){
  var corsOptions;
  if(whitelist.indexOf(req.header('Origin')) !== -1){
    corsOptions = { origin: true }; // reflect (enable) the requested origin in the CORS response
  }else{
    corsOptions = { origin: false }; // disable CORS for this request
  }
  callback(null, corsOptions); // callback expects two parameters: error and options
};

app.get('/', function (req, res) {
  res.end('Ok!');
});

app.post('/api', cors(corsOptionsDelegate), function (req, res) {
  var fstream;
  var files = [];
  var busboy = new Busboy({headers: req.headers});
  busboy.on('file', function (fieldname, file, filename) {
    // fstream = fs.createWriteStream(__dirname + '/uploads/' + filename);
    // stub
{'fraction_non_alphanumeric': 0.17290799815071659, 'fraction_numerical': 0.005547850208044383, 'mean_word_length': 4.383084577114428, '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': '4053013', 'n_tokens_mistral': 681, 'n_tokens_neox': 668, 'n_words': 185}