le

Le db

Le db

Generator style node interface to LevelDB.

var le = require('le');
var co = require('co');
 
var db = le('db');
 
co(function*(){
  yield db.set('foo', 'bar');
  console.log('foo: %s', yield db.get('foo'));
})();
$ npm install le
  • [x] get, set, delete
  • [x] batches
  • [x] prefix ranges
  • [x] interval ranges
  • [ ] test suite
  • [ ] streaming iteration
  • [ ] encodings
  • [ ] plugin interface (no monkey patching!)
  • [ ] nesting
  • [ ] client

Create or open the db at path.

Get the value at key.

Set the value at key to value.

Delete the value at key.

Create a batch.

Queue setting key to value.

Queue deleting the value at key.

Write the batch of operations.

Get all keys (inside range).

Get all values (whose keys are inside range).

db#keys() and db#values() accept string ranges of those formats:

  • ""/"*": get all
  • "prefix*": all keys must start with prefix
  • "[from,to]", "[from,to)", "(from,to]", "(from,to)": all keys must be inside the interval, see interval notations. For infinity to x and vice versa omit the boundary, like [,to].

For now, everything is stored as JSON.

  • want db.use() instead of monkey patching
  • generators for async ops
  • generators for streams
  • efficient nesting and less verbose ranges

MIT