level-lively

Levelup/Leveldb implementation of LivelyDb for doing real-time data binding of a database with local javascript objects.

npm install level-lively
2 downloads in the last week
3 downloads in the last month

level-lively

Levelup/Leveldb implementation of LivelyDb for doing real-time data binding of a database with local javascript objects.

Just one of multiple database implementations for the livedb real-time data-binding framework for replicating databases to local javascript objects.

build status

Installation

This module is installed via npm:

$ npm install level-lively

Example Usage

var levelLively = require('level-lively');

Example Usage

var LevelLively = require('level-lively');
var level = require('level');
var db = level('/path/to/db', { valueEncoding: 'json' });

// Write to the levelup database
var ldb = new LevelLively(db);
ldb.put('my key', 'my value, function (err) {
  // I/O or other error, pass it up the callback chain
  if (err) return callback(err);
});

// Read from the memory database
ldb.get('my key', function (err, value) {
  if (err) {
    if (err.notFound) {
      // handle not found error
      return;
    } else {
      // I/O or other error, pass it up the callback chain
      return callback(err);
    }
  }
});

// Delete from the memory database
ldb.del('my key', function (err) {
  // I/O or other error, pass it up the callback chain
  if (err) return callback(err);
});
npm loves you