<commit_before>#!/usr/bin/env node

// Modules
var connect = require('connect'),
    fs = require('fs'),
    http = require('http'),
    path = require('path'),
    serveStatic = require('serve-static'),
    serveIndex = require('serve-index');

function main(port, rootPath, indexFile) {

    rootPath = path.resolve(rootPath);
    port = parseInt(port);

    var app = connect(),
    hookFile = path.join(rootPath, 'web-server-hook.js');
    hook = {
        config: function() {},
        postConfig: function() {}
    };

    if (fs.existsSync(hookFile)) {
        hook = require(hookFile);
    }

    if (undefined !== hook.config) {
        hook.config(app, port, rootPath);
    }

    app.use(serveStatic(rootPath, {'index': [indexFile]}));
    app.use(serveIndex(rootPath, {'icons': true, 'view': 'details'}));
<commit_msg>Add new server parameter for showing hidden files<commit_after>#!/usr/bin/env node

// Modules
var connect = require('connect'),
    fs = require('fs'),
    http = require('http'),
    path = require('path'),
    serveStatic = require('serve-static'),
    serveIndex = require('serve-index');

function main(port, rootPath, indexFile, showHidden) {

    rootPath = path.resolve(rootPath);
    port = parseInt(port);
    showHidden = !!showHidden;

    var app = connect(),
    hookFile = path.join(rootPath, 'web-server-hook.js');
    hook = {
        config: function() {},
        postConfig: function() {}
    };

    if (fs.existsSync(hookFile)) {
        hook = require(hookFile);
    }

    if (undefined !== hook.config) {
        hook.config(app, port, rootPath);
    }

    var serveStaticConfig = {
        index: [indexFile]
    };

    var serveIndexConfig = {
        icons: true,
        view: 'details'
    };

    if (showHidden) {
        serveStaticConfig.dotfiles = 'allow';
        serveIndexConfig.hidden = true;
    }

    app.use(serveStatic(rootPath, serveStaticConfig));
    app.use(serveIndex(rootPath, serveIndexConfig));

{'fraction_non_alphanumeric': 0.15808080808080807, 'fraction_numerical': 0.0, 'mean_word_length': 2.9072978303747536, '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': '575120', 'n_tokens_mistral': 613, 'n_tokens_neox': 601, 'n_words': 128}