clefs
A pluggable isomorphic file system abstraction
Getting started
Installing
Install the pluggable file system manager
npm i -S clefs
Then install as many layers as you'll need
npm i -S clefs-localstorage clefs-fs clefs-simpleobject
Usage
Node.js
import clefs from 'clefs';
import clefsFs from 'clefs-fs';
import clefsCache from 'clefs-simpleobject';
const fs = clefs([clefsCache, clefsFs]);
const fileContents = await fs.readFile('/path/to/file.txt');
console.log(fileContents);
Browser
import clefs from 'clefs/browser';
import localstorage from 'clefs-localstorage';
import clefsCache from 'clefs-simpleobject';
const fs = clefs([clefsCache, localstorage]);
const fileContents = await fs.readFile('/path/to/file.txt');
console.log(fileContents);
Roadmap
- clefs-dropbox
- clefs-drive
- clefs-box
- Browser tests
- Support the full fs api
Why clefs?
Clefs have layers.
Sure, but why would I use clefs?
Write through from a cache to a local file system or browser local storage and to a cloud file storage provider with a single call. Has a pleasant promise-based interface that works nicely with async and await.
Special Thanks
Special thanks to jonadab for the creative commons licensed clef image.