delete a line from text file using node js code example
Example 1: how to get a particular line from a file in nodejs
lineReader.open('/path/to/file', function(reader) {
if (reader.hasNextLine()) {
reader.nextLine(function(line) {
console.log(line);
});
}
});
Example 2: how to get a particular line from a file in nodejs
lineReader.eachLine('path/to/file', function(line) {
console.log(line);
if (line.includes('STOP') {
return false; // stop reading
}
});