<commit_before>var fs = require('fs'),
	path = require('path'),
	TMP = '.tmp',
	OK_TMP = '.ok' + TMP,
    im = require('imagemagick');

exports.init = function(app) {

	function render(res, filename) {
		fs.createReadStream(filename)
			.on('error', function(err){
				if (err.code === 'ENOENT'){
					res.writeHead(404, {
						'Content-type': 'text/plain'
					});
					res.end('404 Not Found\n');
				} else {
					res.writeHead(500, {
						'Content-type': 'text/plain'
					});
					res.end(err + '\n');
				}
			})
			.on('open', function(){
				res.writeHead(200, {
					'Pragma': 'public',
					'Cache-Control': 'private, max-age=10',
					'Content-type': ''
				});
			})
			.pipe(res);
	}

	function getFilename(params) {
		return path.resolve(__dirname, '../upload/' + params.id + '/' + params.module + '/' + params.filename);
	}

	function resizeRender(res, resizeParams) {
    	fs.exists(resizeParams.dstPath, function(exists) {
            if (exists) {
            	render(res, resizeParams.dstPath);
            } else {
                im.resize(resizeParams, function(err) {
                    if (err) {
                        res.writeHead(500, {
							'Content-type': 'text/plain'
						});
						res.end(err + '\n');
                    } else {
                    	render(res, resizeParams.dstPath);
                    }<commit_msg>whitespace<commit_after>var fs = require('fs'),
	path = require('path'),
	TMP = '.tmp',
	OK_TMP = '.ok' + TMP,
    im = require('imagemagick');

exports.init = function(app) {

    function getFilename(params) {
        return path.resolve(__dirname, '../upload/' + params.id + '/' + params.module + '/' + params.filename);
    }

	function render(res, filename) {
		fs.createReadStream(filename)
			.on('error', function(err){
				if (err.code === 'ENOENT'){
					res.writeHead(404, {
						'Content-type': 'text/plain'
					});
					res.end('404 Not Found\n');
				} else {
					res.writeHead(500, {
						'Content-type': 'text/plain'
					});
					res.end(err + '\n');
				}
			})
			.on('open', function(){
				res.writeHead(200, {
					'Pragma': 'public',
					'Cache-Control': 'private, max-age=10',
					'Content-type': ''
				});
			})
			.pipe(res);
	}

	function resizeRender(res, resizeParams) {
        fs.exists(resizeParams.dstPath, function(exists) {
            if (exists) {
                render(res, resizeParams.dstPath);
            } else {
                im.resize(resizeParams, function(err) {
                    if (err) {
                        res.writeHead(500, {
							'Content-type': 'text/plain'
						});
						res.end(err + '\n');
                    } else {
                        render(res, resizeParams.dstPath);
                    }
{'fraction_non_alphanumeric': 0.17677136596055515, 'fraction_numerical': 0.01241782322863404, 'mean_word_length': 1.9325481798715203, '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': '1723174', 'n_tokens_mistral': 1100, 'n_tokens_neox': 876, 'n_words': 150}