I need to read large text files and find their length and save their data. I want to save their content as an array.
when I debug the program I can see the array isn't empty, and I can see the wanted content.
But when I try to print the array all I get is [object Object].
Code
function ReadAllFileFromFileList(files, allFileGenesDetails) {
$("#my-progressbar-container").show();
//Retrieve all the files from the FileList object
if (files) {
for (var i = 0, f; f = files[i]; i++) {
var r = new FileReader();
r.onload = (function(f) {
var callBckFunction = RunVanDiagramAlgorithm_phase2;
return function(e) {
var fileGenesDetails = new Array();
var geneQuery = new OrderedMap();
var contents = e.target.result;
// Parse the data
var contentEachLine = contents.split("\n");
for (var jj = 0; jj < contentEachLine.length; jj++) {
var lineContent = contentEachLine[jj].split("\t");
// Verify there line structure is correct
if (lineContent.length >= 2) {
var geneDetails = {
Query: lineContent[0],
Subject: lineContent[1]
};
if (!m_vennDiagramArguments.chkRemoveDuplicates_isChecked || !geneQuery.isContainKey(geneDetails.Query)) {
geneQuery.set(geneDetails.Query, geneDetails.Query);
fileGenesDetails.push(geneDetails);
}
}
}
// thats the array Im trying to print
allFileGenesDetails.push(fileGenesDetails);
document.getElementById("resultss").innerHTML = allFileGenesDetails.toString();
FinishReadingFile(callBckFunction);
};
})(f);