Create a slice-file instance xs from a filename and some options opts.
These opts are passed to fs.open():
opts.flags - string flags to open the file with, default "r"
opts.mode - mask to open the file with, default 0666
If you already have a file descriptor open you can pass opts.fd to skip
calling fs.open().
Use opts.bufsize to set how much data to read in each chunk. Default 4096.
var stream = xs.slice(i, j, cb)
Return a readable stream that emits each line between line numbers [i,j)
exactly like Array.prototype.slice(). Each line data buffer includes a
trailing "\n" except for the last line if there is no trailing newline before
the EOF.
Just like Array.prototype.slice(), i and j may be negative.
If cb(err, lines) is given, the lines will be buffered into lines.
var stream = xs.sliceReverse(i, j, cb)
Return a readable stream that emits each line between line numbers [i,j)
just like .slice() but in reverse order. This is more efficient for
negative-indexed slices because the lines don't need to be buffered.
If cb(err, lines) is given, the lines will be buffered into lines.
var stream = xs.follow(i, j)
Return a readable stream of lines like xs.slice(), but instead of ending when
the end of the file is reached, watch the file and stream new lines appended to
the end of the file.
This feature takes its name from tail -f.
xs.close()
Close the underlying file descriptor, stop any streams, and stop any file
watchers.