nickewing / line-reader

Asynchronous line-by-line file reader for node.js
MIT License
453 stars 75 forks source link

Why Only returns the last line of the file #14

Closed shanelau closed 8 years ago

shanelau commented 10 years ago

My file‘name is "city.txt",

·58453 beijing 58665 shanghai 58559 china 58652 mmm·

just return the last line "58652 mmm". Tell me why! My code is ·lineReader.open('./city.txt', function(reader) { if (reader.hasNextLine()) { reader.nextLine(function(line) { console.log(line); var result = line.split(" "); //console.log(result[0]+"\t"+result[1]); }); } });·

shanelau commented 10 years ago

line break is “\r\n” ,not "\r" so I have fix my erro!