This class allows you to get lines (a range) from very BIG FILES very fast
getLines(filename, fromLine, toLine)
const indexer = require('./indexer')
const i = new indexer()
// Get lines deep inside file, from line 5000000 to line 5000010
let lines = i.getLines('/home/mzalazar/big_file.txt', 5000000, 5000010) // ultra-fast (once indexed)
- Files are indexed using 64bits numbers stored in a file called filename.ext.index (as newline offsets)
- Files are indexed automatically when *getLines() is called, or by calling makeIndex(filename)
- Files/indexes are kept open and their handlers are saved (acting like a cache, for fast access)
This class is experimental, do whatever you need to improve it or use it as it is!