nickewing / line-reader

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

Any way to stop/abort reading a file in the eachLine method? #47

Open Michal2SAB opened 3 years ago

Michal2SAB commented 3 years ago

I need to stop reading a file once it gets to certain line & just stop whatever else is going on in the eachLine part. How can I do that? I've read through the docs and searched on the internet but found nothing that works. Please tell me it's possible to do

TheSecurityDev commented 2 years ago

Can't you just return false in the eachLine callback? The docs state: If the callback returns false, reading will stop and the file will be closed.