1.0.0 • Published 9 years ago
node-nthline v1.0.0
node-nthline

nthline reads specific line from file without buffering the entire file to memory. Under the hood it uses Node’s readline module.
Install
npm i -S nthlineUsage
Module exposes just one function: nthline with signature: (rowNumber:Number, filePath:String) → Promise.
(async () => {
const nthline = require('nthline')
, filePath = '/path/to/100-million-rows-file'
, rowNumber = 42
console.log(await nthline(rowNumber, filePath))
})()Since it returns a promise you could rewrite previous example like that:
const nthline = require('nthline')
, filePath = '/path/to/100-million-rows-file'
, rowNumber = 42
nthline(rowNumber, filePath)
.then(line => console.log(line))1.0.0
9 years ago