0

I'm using the plugin line-by-line to read a very large file. There's a case where I want just the first line, so I'd close the connection immediately in that case.

However, I was noticing that it would try to process the next line regardless. I dumbed it down as far as I could, and wrote this:

lr.on("line", function (line) {
  lr.pause();
  console.log("\rLine");
  lr.close();
}

My console shows:

Line

Line

Without the lr.close(), it only logs Line once.

What am I missing?

Randy Hall
  • 7,716
  • 16
  • 73
  • 151

1 Answers1

1

Take a look to Source

It print last lineFragment for you.
If you don't need it - call lr.end();.


Community
  • 1
  • 1
vp_arth
  • 14,461
  • 4
  • 37
  • 66