1.0.0 • Published 8 years ago

loki-msgpack-adapter v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

loki-msgpack-adapter

A simple lokijs "proxy" adapter using msgpack-lite to serialize the database.

Usage

npm i --save loki-msgpack-adapter

// Should work with all normal (not reference) mode persistenceAdapters
var myAdapter = new myPersistenceAdapter(/*...*/);
// if you don't pass an adapter we will try to use lokijs fs adapter
var proxy = new lokiMsgpackAdapter({adapter: myAdapter});

var db = new loki('test.db', {adapter: proxy /* ... */});
/* use your db as normal */
// ...
db.saveDatabase();
// Your adapter saved the db in the messagepack format

In browser just drop in lokijs and msgpack-lite and your are ready to go.

In node loki-msgpack will require the dependencies itself.

If you are using something like browserify or webpack all should work fine :).

Having questions ? Found a bug ? Need a feature ?

Just open an issue here or even better a pull request.

I'd love to see contibution.

Thanks to

  • @techfort and all lokijs contributors for building and maintaining lokijs
  • @kawanet and all msgpack-lite contributors for building and maintaining msgpack-lite.

These are awesome projects.