hi, first of all: in js we don't speak about associative arrays, because we dont have any. We have objects, though the name hash is ok to signal that the object is meant just as simple key-> value storage. But if you use an Array instance then you get disadvantages and not what you're expecting. when i see your code, the object is what you might want.
second: the event is called "end" not "eof": https://github.com/Gagle/Node-BufferedReader/wiki/Reference third, yes, use the counter: ======= var fs = require('fs'); var reader = require ("buffered-reader"); var DataReader = reader.DataReader; function test() { var hash = {}; var files = ["file1", "file2"]; var fileCounter = 0; files.forEach(function(file){ new DataReader (file, { encoding: "utf8" }) .on ("end", function() { fileCounter++; if(fileCounter == files.length) console.log(hash); }) .on ("line", function (line){ var reg = new RegExp(";", "g"); var fields = line.split(reg); var value = fields[0]; var key = fields[1]; hash[key] = value; console.log(hash[key]); }) .read (); } } test(); ===== -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
