🚀 Launch Week Day 4:Introducing the Alert Details Page: A Better Way to Explore Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

read-file-live

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-file-live

Read a file and re-read it when it changes

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

read-file-live

Read a file and re-read it when it changes

npm install read-file-live

Useful if you are writing command line tools that monitor configuration files.

Usage

var readFile = require('read-file-live')

readFile('somefile.txt', function (buf) {
  // is the file had been deleted buf === null
  console.log('somefile.txt updated. content ->', buf)
})

API

var stop = readFile(onread)

Read a file and re-read it when it changes. onread will be called with a buffer of the file content when the file changes or is being read the first time. If the file has been deleted the content buffer will be null.

Call stop to stop reading.

License

MIT

FAQs

Package last updated on 27 Jan 2017

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