<commit_before>/**
 * Static
 */

var fs = require('fs')
  , join = require('path').join;

module.exports = function(opt) {
  var path = opt.path || opt
    , list = fs.readdirSync(path);

  return function(req, res, next) {
    if (req.method !== 'GET'
        && req.method !== 'HEAD') return next();

    if (~req.url.indexOf('..')) return res.error(403);

    // this removes the need for stat calls
    //if (!~list.indexOf(req.path[0])) return next();

    res.sendfile(join(path, req.pathname), next);

    //res.sendfile(join(path, req.pathname), function(err) {
    //  if (err && err.code === 'ENOENT') return next();
    //  next(err);
    //});
  };
};<commit_msg>static<commit_after>/**
 * Static
 */

var fs = require('fs')
  , join = require('path').join;

module.exports = function(opt) {
  var path = opt.path || opt;
  return function(req, res, next) {
    if (req.method !== 'GET'
        && req.method !== 'HEAD') return next();

    if (~req.url.indexOf('..')) return res.error(403);

    res.sendfile(join(path, req.pathname), next);

    //res.sendfile(join(path, req.pathname), function(err) {
    //  if (err && err.code === 'ENOENT') return next();
    //  next(err);
    //});
  };
};
{'fraction_non_alphanumeric': 0.2180016515276631, 'fraction_numerical': 0.005780346820809248, 'mean_word_length': 2.8354430379746836, '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': '6291411', 'n_tokens_mistral': 433, 'n_tokens_neox': 417, 'n_words': 95}