Opal-Estate-Pro/node_modules/continuable-cache
2019-09-13 11:27:52 +07:00
..
test style Dashboard 2019-09-13 11:27:52 +07:00
.jshintrc style Dashboard 2019-09-13 11:27:52 +07:00
.npmignore style Dashboard 2019-09-13 11:27:52 +07:00
.testem.json style Dashboard 2019-09-13 11:27:52 +07:00
.travis.yml style Dashboard 2019-09-13 11:27:52 +07:00
index.js style Dashboard 2019-09-13 11:27:52 +07:00
LICENCE style Dashboard 2019-09-13 11:27:52 +07:00
package.json style Dashboard 2019-09-13 11:27:52 +07:00
README.md style Dashboard 2019-09-13 11:27:52 +07:00

continuable-cache

Cache a continuable

Example

var cache = require("continuable-cache")
var fs = require("fs")

var readFile = function (uri) { return function (cb) {
    fs.readFile(uri, cb)
} }

var continuableFile = readFile("./package.json")

var cached = cache(continuableFile)

// will only do one file read operation
cached(function (err, file) {
    /* calls out to fs.readFile */
})

cached(function (err, file) {
    /* get's either err or file from cache in cached */
})

Installation

npm install continuable-cache

Contributors

  • Raynos

MIT Licenced