A file cache inspired by lru-files-promise.
Least recently used files are deleted. It's helpful if your filesystem uses
Everything is written to files and nothing is kept in-memory.
npm install lru-files-promise
var lrufiles = ;var cache =root: "/"dir: "tmp" // directory to store caches filesfiles: 100 // maximum number of filessize: "1 GB" // maximum total file sizecheck: 10 // interval of stale checks in minutes;// add a file to cache. you can submit a buffer...await cache;// ... readable stream ...await cache;// ... or objectawait cache;// get a file from cache// the value is a Bufferlet value = cache;// get a readable stream to a cached file, straight...let stream = await cache;// check if a file is cachedlet exists = await cache;// update a files access timeawait cache;// get list of all files cachedlet keys = await cache;// remove a file from cachelet deleted = await cache;// manually remove old filesawait cache;// empty everythingawait cacheclear;// All functions return a promise so following syntax can be used for all functions// this is alternate way when you don't want to use async / await.cache;