fs-reverse

stream the lines of a file in reverse order!

npm install fs-reverse
7 downloads in the last month

fs-reverse

read a file backwards.

var fsR = require('fs-reverse')

fsR(filename, opts)
  .pipe(writableStream)

the file will be read from the tail end, split into lines, and emitted in reverse order.

default options are:

{ flags: 'r' //may only be 'r' or 'rx'
, mode: 0666
, bufferSize: 64 * 1024
, matcher: '\n' //may be a string or regular expression.
}

except for matcher, the options are a subset of createReadStream in fs

If matcher is a regular expression with a group, like /(\r?\n)/ then the split pattern will be perserved and emitted as a chunk.

License

MIT / Apache 2

npm loves you