keep-reading

1.1.0 • Public • Published

keep-reading

keep reading a file. like tail but with no concept of lines and no watching.

var tail = require('keep-reading')

var stream = tail('/var/log/some.log')

stream.on('data',function(buf){
  console.log(buf,'is the data read from the file.')
  console.log(buf.start,'is the byte offset of the bufers starting position in the file')
})

stream.on('waiting',function(duration){
  console.log('will wait for ',duration,'ms before checking to see if the file has more data. exponential backoff')
})

stream.on('open',function(fd){
  console.log(fd,'is the file descriptor being read')
})

stream.on('close',function(){
  console.log('the file descriptor is closed. always fires after end.')
})

Readme

Keywords

Package Sidebar

Install

npm i keep-reading

Weekly Downloads

1

Version

1.1.0

License

ISC

Last publish

Collaborators

  • soldair