Socket
Book a DemoInstallSign in
Socket

fs-backwards-stream

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-backwards-stream

stream a file backwards

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

fs-backwards-stream

exact same api as fs.createReadStream except reads chunks backwards. similar to fs-reverse except doesnt parse lines.

Stream data from start to end. if start is less than end they are switched rather then just not being useful.

var backwardsStream = require('fs-backwards-stream')

var s = backwardsStream(filename)

s.on('data',function(buf){
  console.log(buf.toString());
})

[1 2 3 4 5 6 7 8 9 10 11 12 13 14]
start of file  <---- end of file

options

  • start

    • where to start reading. defaults to the end of the file
  • end

    • where to stop reading. defaults to 0. ie i start from 1000 and stop at 10
  • block

    • number of bytes to read at a time (default: 1024 bytes)
  • shorterFirst

    • if the filesize is not a multiple of the blocksize, make the first block read (from the nd of the file) shorter, instead of the last (in the beginning of the file) (default: false)

FAQs

Package last updated on 26 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts