readfilecache

0.1.0 • Public • Published

SYNOPSIS

Returns data from fs.readFile or memory conditional on the mtime from an fs.stat.

USAGE

//
// create a cache instance
//
var cache = require('reafilecache')()

//
// read a file, a call to the same path will return 
// the data from memory if the mtime is the same
// on the file as it is in memory.
//

cache.readFile(filename, function(err, data, stat) {
  // err or null, the data from the file and the stat info
})

//
// supports a sync api as well
//
cache.readFileSync(filename) // returns the file

//
// clear the cache
//
cache.invalidate()

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i readfilecache

    Weekly Downloads

    3

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • hij1nx