<commit_before>var debug = require('debug')('p3api-server:media');
var xlsx = require('node-xlsx');
var fs = require("fs-extra");
var config = require("../config");
var Path=require("path");
var Deferred = require("promised-io/promise").defer;
var when = require("promised-io/promise").when;
var treeDir = config.get("treeDirectory");


var wrap = function(str,linelen){
	if (str.length <= linelen ){
		return str;
	}
	var out=[];
	var cur=0;
	while (cur < str.length){
		if (cur+linelen>str.length){
			out.push(str.slice(cur,str.length-1));
			cur = str.length;
		}else{
			out.push(str.slice(cur, cur + linelen))
			cur = cur + linelen + 1;
		}
	}	
	return out.join("\n");	

}

module.exports=function(req,res,next){
	res.formatStart= new Date();

	var rpcTypes = ["application/jsonrpc.result+json", "application/jsonrpc+json"];

	/*
	res.header("Cache-Control", "no-cache, no-store, must-revalidate");
	res.header("Pragma", "no-cache");
	res.header("Expires", 0);
	*/


	if (rpcTypes.some(function(t){<commit_msg>handle missing sequence in wrap<commit_after>var debug = require('debug')('p3api-server:media');
var xlsx = require('node-xlsx');
var fs = require("fs-extra");
var config = require("../config");
var Path=require("path");
var Deferred = require("promised-io/promise").defer;
var when = require("promised-io/promise").when;
var treeDir = config.get("treeDirectory");


var wrap = function(str,linelen){
	if (!str){ str = "" }
	if (str.length <= linelen ){
		return str;
	}
	var out=[];
	var cur=0;
	while (cur < str.length){
		if (cur+linelen>str.length){
			out.push(str.slice(cur,str.length-1));
			cur = str.length;
		}else{
			out.push(str.slice(cur, cur + linelen))
			cur = cur + linelen + 1;
		}
	}	
	return out.join("\n");	

}

module.exports=function(req,res,next){
	res.formatStart= new Date();

	var rpcTypes = ["application/jsonrpc.result+json", "application/jsonrpc+json"];

	/*
	res.header("Cache-Control", "no-cache, no-store, must-revalidate");
	res.header("Pragma", "no-cache");
	res.header("Expires", 0);
	*/


	if (rpcTypes.some(function(t){
{'fraction_non_alphanumeric': 0.20048192771084336, 'fraction_numerical': 0.004819277108433735, 'mean_word_length': 4.610810810810811, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '6095105', 'n_tokens_mistral': 799, 'n_tokens_neox': 760, 'n_words': 148}