Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (12 sloc) 355 Bytes

Simple file cache

Usage

var simpleFileCache = require('simplefilecache');

var getTextFile = simpleFileCache('textfile.txt');

setInterval(function(){

  getTextFile(function(err, content){
    if(err)
      console.log(err)
    else
      console.log("Content: " + content)
  })

}, 5000);