<commit_before>var http = require('http'),
  url = require('url'),
  path = require('path'),
  fs = require('fs');
var mimeTypes = {
  "html": "text/html",
  "jpeg": "image/jpeg",
  "jpg": "image/jpeg",
  "png": "image/png",
  "js": "text/javascript",
  "css": "text/css"
};

function respondWithFile(res, req, fileName) {
  var fileNames = Array.isArray(fileName) ? fileName : [fileName];

  for (var i in fileNames) {
    fileName = fileNames[i];

    if (fs.existsSync(fileName)) {
      var mimeType = mimeTypes[path.extname(fileName).split(".")[1]];
      res.writeHead(200, mimeType);

      var readStream = fs.createReadStream(fileName);
      readStream.pipe(res);
      return true;

    }
  }
  return false;
}

module.exports = function (options) {

  var plugins = options.plugins || [];

  function startServer() {
    http.createServer(function (req, res) {
      var uri = url.parse(req.url).pathname,
        requestOptions = {
          req: req,
          res: res,
          uri: uri,
          base: './' + options.buildPath
        };

      // iterate through all available plugins to handle the request
      var callback = function (i) {
        function next() {
          i++;
          var nextPlugin = plugins[i];
          console.log('CHECKING: ' + i);
          if (nextPlugin) {
            var nextCallback = callback(i);
            nextPlugin.onRequest(requestOptions, options, nextCallback);
          } else {
            // no plugin has responded
            res.writeHead(404, {
              'Content-Type': 'text/plain'
            });<commit_msg>remove debug code<commit_after>var http = require('http'),
  url = require('url'),
  path = require('path'),
  fs = require('fs');
var mimeTypes = {
  "html": "text/html",
  "jpeg": "image/jpeg",
  "jpg": "image/jpeg",
  "png": "image/png",
  "js": "text/javascript",
  "css": "text/css"
};

function respondWithFile(res, req, fileName) {
  var fileNames = Array.isArray(fileName) ? fileName : [fileName];

  for (var i in fileNames) {
    fileName = fileNames[i];

    if (fs.existsSync(fileName)) {
      var mimeType = mimeTypes[path.extname(fileName).split(".")[1]];
      res.writeHead(200, mimeType);

      var readStream = fs.createReadStream(fileName);
      readStream.pipe(res);
      return true;

    }
  }
  return false;
}

module.exports = function (options) {

  var plugins = options.plugins || [];

  function startServer() {
    http.createServer(function (req, res) {
      var uri = url.parse(req.url).pathname,
        requestOptions = {
          req: req,
          res: res,
          uri: uri,
          base: './' + options.buildPath
        };

      // iterate through all available plugins to handle the request
      var callback = function (i) {
        function next() {
          i++;
          var nextPlugin = plugins[i];
          if (nextPlugin) {
            var nextCallback = callback(i);
            nextPlugin.onRequest(requestOptions, options, nextCallback);
          } else {
            // no plugin has responded
            res.writeHead(404, {
              'Content-Type': 'text/plain'
            });
{'fraction_non_alphanumeric': 0.1457206490614063, 'fraction_numerical': 0.004454342984409799, 'mean_word_length': 2.302521008403361, 'pattern_counts': {'":': 12, '<': 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': '6308617', 'n_tokens_mistral': 966, 'n_tokens_neox': 951, 'n_words': 228}