Skip to content

A lokijs "proxy" adapter using messagepack to serialize the database.

License

Notifications You must be signed in to change notification settings

Kanaye/loki-msgpack-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A lokijs "proxy" adapter using messagepack to serialize the database.

Resources

License

Stars

Watchers

Forks

Packages

No packages published