Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/heapwolf/readfilecache
does exactly what you think it does
https://github.com/heapwolf/readfilecache
Last synced: 25 days ago
JSON representation
does exactly what you think it does
- Host: GitHub
- URL: https://github.com/heapwolf/readfilecache
- Owner: heapwolf
- Created: 2013-11-24T01:45:39.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2013-12-01T20:04:54.000Z (almost 11 years ago)
- Last Synced: 2024-04-23T07:20:04.026Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 112 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SYNOPSIS
Returns data from fs.readFile or memory conditional on the mtime from an fs.stat.# USAGE
```js
//
// create a cache instance
//
var cache = require('readfilecache')()//
// 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()
```