<commit_before>#!/usr/bin/env node
var http  = require('http')
  , fs    = require('fs')
  , path  = require('path')
  , mime  = require('mime')
  , cache = {};

function send404(response) {
  response.writeHead(404, {'Content-Type': 'text/plain'});
  response.write('Error 404: resource not found.');
  response.end();
}

function serveStatic(response, cache, absPath) {
  if (cache[absPath]) {
    response.writeHead('content-type', mime.lookup(path.basename(absPath)));
    response.end(cache[absPath]);
  } else {
    path.exists(absPath, function(exists) {
      if (exists) {
        fs.readFile(absPath, function(err, data) {
          cache[absPath] = data;
          response.writeHead('content-type', mime.lookup(path.basename(absPath)));
          response.end(data);
        });
      } else {
        send404(response);
      }
    });
  }<commit_msg>Tiny style tweak.<commit_after>#!/usr/bin/env node
var http  = require('http')
  , fs    = require('fs')
  , path  = require('path')
  , mime  = require('mime')
  , cache = {};

function send404(response) {
  response.writeHead(404, {'Content-Type': 'text/plain'});
  response.write('Error 404: resource not found.');
  response.end();
}

function serveStatic(response, cache, absPath) {
  if (cache[absPath]) {
    response.writeHead(
      'content-type',
      mime.lookup(path.basename(absPath))
    );
    response.end(cache[absPath]);
  } else {
    path.exists(absPath, function(exists) {
      if (exists) {
        fs.readFile(absPath, function(err, data) {
          cache[absPath] = data;
          response.writeHead(
            'content-type',
            mime.lookup(path.basename(absPath))
          );
          response.end(data);
        });
      } else {
        send404(response);
      }
    });
  }
{'fraction_non_alphanumeric': 0.1674132138857783, 'fraction_numerical': 0.013437849944008958, 'mean_word_length': 2.754201680672269, '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': '2160058', 'n_tokens_mistral': 603, 'n_tokens_neox': 578, 'n_words': 98}