how to get a particular line from a file in nodejs

Solutions on MaxInterview for how to get a particular line from a file in nodejs by the best coders in the world

showing results for - "how to get a particular line from a file in nodejs"
Antonella
10 Jul 2018
1lineReader.open('/path/to/file', function(reader) {
2    if (reader.hasNextLine()) {
3        reader.nextLine(function(line) {
4            console.log(line);
5        });
6    }
7});
8
Antonio
16 Jan 2016
1$ npm install --save line-reader
2
Alessandro
12 Jan 2020
1lineReader.eachLine('path/to/file', function(line) {
2    console.log(line);
3    if (line.includes('STOP') {
4        return false; // stop reading
5    }
6});
7