Cacheable FS
Cacheable file system methods for holding file reads in memory
Usage
var cfs = require('cacheable-fs');
cfs.cache.readFile('path/to/file.txt').then(function(content) {
});
cfs.cache.createReadStream('path/to/file.txt')
.pipe( ... );
Methods
Promisified
All of the following methods will return a promise
cache.readFile(path)
- Read a filecache.concat(files)
- Concatenates an array of filescache.copy(path)
- Copies a file from one location to another creating directoriesreadFile(path, [...])
- Promisified wrapper to fs.readFilewriteFile(path, [...])
- Promisified wrapper to fs.writeFile
Other
cache.createReadStream(path)
- Read a file (returns a stream)cache.expire(path)
- Expire a given path from cachecache.getCache()
- Returns the raw cache object (debugging)cache.watch(fn)
- Watch the file system and trigger a callback on each change or deletion. Callback is fn(eventName, path)
.cache.unwatch()
- Stop watching the file system
Properties