File Stream's Nth Line

07/10/2014, Thu
Categories: #JavaScript
Tags: #NodeJs

Nth Line

In Nodejs, when reading a stream from a file, the process of getting the nth line requires reading (nth - 1) lines. A filestream's data comes as it is ready and in order, but there is no means of jumping to a specific nth line of the stream.

This is an inconvenience, but this required behavior of 'iterating through the lines until the desired line is found' is also present in many other programming languages.