line-reader icon indicating copy to clipboard operation
line-reader copied to clipboard

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

Open Michal2SAB opened this issue 3 years ago • 1 comments

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

Michal2SAB avatar Nov 04 '21 11:11 Michal2SAB

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.

TheSecurityDev avatar Nov 16 '21 18:11 TheSecurityDev