A pluggable isomorphic file system abstraction
Install the pluggable file system manager
npm i -S clefsThen install as many layers as you'll need
npm i -S clefs-localstorage clefs-fs clefs-simpleobjectUse clefs on the server!
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);Use clefs in the 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);- clefs-dropbox
- clefs-drive
- clefs-box
- Browser tests
- Support the full fs api
Clefs have layers.
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 to jonadab for the creative commons licensed clef image.