Skip to content

ganna-shmatova/fs-reverse

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fs-reverse

read a file backwards.

// Usage: node <thissnippet.js> <filename>
var fsR = require('fs-reverse')
  , filename = process.argv[2]

fsR(filename, {})
  .pipe(process.stdout)

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

About

No description, website, or topics provided.

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE.APACHE2
MIT
LICENSE.MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%