[Solved] Node js line by line module


Look at the documentation:

You can also pass start and end position in bytes to read from file
region:

{ encoding: 'utf8',
  skipEmptyLines: true,
  start: 1000 }

Your instruction says to start at byte 10 not line 10.

If you want to skip lines, you’ll have to keep count of them yourself.

const LineByLineReader = require("line-by-line");
const lr = new LineByLineReader("data.txt");
let lineCount = 0;

lr.on("line", function(line) {
    lineCount++;
    if (lineCount < 10) {
        return;
    }
    console.log(line);
});

solved Node js line by line module