Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/heapwolf/level-key

The easiest way to work with sublevels through multilevel.
https://github.com/heapwolf/level-key

Last synced: 25 days ago
JSON representation

The easiest way to work with sublevels through multilevel.

Awesome Lists containing this project

README

        

# SYNOPSIS
The easiest way to work with sublevels through multilevel.

# MOTIVATION
- Multilevel doesn't allow you to create sublevels.
- In order to use `db.sublevel('foo')`, multilevel
maintains a list of sublevels that needs to be
up to date in the `manifest.json`.

# USAGE
The same method can be used to install level-key on
the server, the method will be written to the `manifest.json`.

```js
var multilevel = require('multilevel');
var net = require('net');
var key = require('level-key');

var db = multilevel.client();
var con = net.connect(3000);

con.pipe(db.createRpcStream()).pipe(con);

var k = key('reports', 'yearly', 'today');
var val = {};

client.put(k, val, function(err) {
/* ... */
});

client
.createReadStream({ gte: k, lte: k + '~' })
.on('data', function(d) {
/* ... */
});
```