<commit_before>/*
	NightDL
	by <NAME>, llana digital

	https://matt-walton.net
	https://llana.co
*/

var http = require("http"),
	https = require("https"),
	urlm = require("url"),
	path = require("path"),
	fs = require("fs"),
	express = require("express"),
	config = require("./config.json");

var app = express();
app.configure(function() {
	app.use(express.urlencoded());
	app.use(config.baseurl + "/static", express.static(__dirname + "/static"))
	app.set("view engine", "ejs");
});

var baseurl = config.baseurl;

if (config.baseurl == "") {
	baseurl = "/";
}

var downloadList = [];
var dlIndex = 0;
var dlID = 0;

function init() {
	var folderList = fs.readdirSync(__dirname + "/files");
	if (folderList.length > 0) {
		dlIndex = parseInt(Math.max.apply(Math, folderList)) + 1;
	}
}

function addDownload(url, filename) {
	var parsed = urlm.parse(url);
	
	if (!filename)
		filename = path.basename(parsed.pathname);<commit_msg>Server now automatically creates file folder<commit_after>/*
	NightDL
	by <NAME>, llana digital

	https://matt-walton.net
	https://llana.co
*/

var http = require("http"),
	https = require("https"),
	urlm = require("url"),
	path = require("path"),
	fs = require("fs"),
	express = require("express"),
	config = require("./config.json");

var app = express();
app.configure(function() {
	app.use(express.urlencoded());
	app.use(config.baseurl + "/static", express.static(__dirname + "/static"))
	app.set("view engine", "ejs");
});

var baseurl = config.baseurl;

if (config.baseurl == "") {
	baseurl = "/";
}

var downloadList = [];
var dlIndex = 0;
var dlID = 0;

function init() {
	if (!fs.existsSync(__dirname + "/files"))
		fs.mkdirSync(__dirname + "/files");

	var folderList = fs.readdirSync(__dirname + "/files");
	if (folderList.length > 0) {
		dlIndex = parseInt(Math.max.apply(Math, folderList)) + 1;
	}
}

function addDownload(url, filename) {
	var parsed = urlm.parse(url);
	
	if (!filename)
		filename = path.basename(parsed.pathname);
{'fraction_non_alphanumeric': 0.1910055583628095, 'fraction_numerical': 0.00404244567963618, 'mean_word_length': 4.424657534246576, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1306347', 'n_tokens_mistral': 703, 'n_tokens_neox': 683, 'n_words': 153}