0.0.3 • Published 2 years ago
cacheable-fs v0.0.3
Cacheable FS
Cacheable file system methods for holding file reads in memory
Usage
var cfs = require('cacheable-fs');
// Promise style
cfs.cache.readFile('path/to/file.txt').then(function(content) {
// ... do something with content
});
// Stream style
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 isfn(eventName, path).cache.unwatch()- Stop watching the file system
Properties
fs- Exposing graceful-fs
0.0.3
2 years ago