<commit_before><commit_msg>Added Words Module<commit_after>var Utils = require('./utils');
var path = require('path');
var fs = require('fs');
var AsposeStorage = require('./aspose-storage');

function AsposeWords(config) {
	this.appSID = config.appSID;
	this.appKey = config.appKey;
	this.baseURI = config.baseURI;
}

/* Conversion Methods */

AsposeWords.prototype.convertLocalFile = function(fileStream,saveFormat,callback){
	fileStream = typeof fileStream !== 'undefined' ? fileStream : '';
	saveFormat = typeof saveFormat !== 'undefined' ? saveFormat : '';
	
	if(fileStream === ''){
		throw new Error('file stream not provided.');
	}
		
	if(saveFormat === ''){
		throw new Error('save format missing.');
	}
	
	
	var strURI = this.baseURI + 'words/convert?format='+saveFormat;
	var signedURI = Utils.Sign(strURI,this.appSID,this.appKey);
	
	Utils.ProcessCommandStream('PUT',signedURI,fileStream,function(data){

		if(typeof callback === 'function'){
			callback.call(null,data);
		}
	});
};

AsposeWords.prototype.convert = function(fileName,saveFormat,callback){
	fileName = typeof fileName !== 'undefined' ? fileName : '';
	saveFormat = typeof saveFormat !== 'undefined' ? saveFormat : '';
	
	if(fileName === ''){
		throw new Error('Filename not defined.');
	}
		
	if(saveFormat === ''){
		throw new Error('save format missing.');
	}
	
	
	var strURI = this.baseURI + 'words/' + fileName + '?format='+saveFormat;
	var signedURI = Utils.Sign(strURI,this.appSID,this.appKey);
	
	Utils.ProcessCommandContent('GET',signedURI,'',function(data){
		if(typeof callback === 'function'){
			callback.call(null,data);
		}
	});
};

module.exports = AsposeWords;
{'fraction_non_alphanumeric': 0.16928657799274485, 'fraction_numerical': 0.0, 'mean_word_length': 5.084558823529412, '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': '6158036', 'n_tokens_mistral': 553, 'n_tokens_neox': 518, 'n_words': 101}