keyv-fs
Version:
file system storage adapter for keyv
43 lines (26 loc) • 1.22 kB
Markdown
[](https://www.npmjs.org/package/keyv-fs)
[](https://travis-ci.org/roneyrao/keyv-fs)
[](https://codecov.io/gh/roneyrao/keyv-fs)
[](https://raw.githubusercontent.com/roneyrao/keyv-fs/master/LICENSE)
Filesystem storage adapter for [Keyv](https://github.com/lukechilds/keyv). Especially useful for browser cache.
```shell
npm install keyv-fs
```
```js
const Keyv = require('keyv');
const KeyvFs = require('keyv-fs');
const fsStore = new KeyvFs();
const keyv = new Keyv({ store: fsStore });
```
```
new KeyvFs(fs, rootDir, clean)
```
* fs: custom file system, such as [memory-fs](https://github.com/webpack/memory-fs), if omited, local file system is implied.
* rootDir: directory where cache folder is placed, `process.cwd()` is by default. Cache folder is named with keyvs namespace.
* clean: whether to clear the cache folder when startup, false by default.
[](LICENSE).