Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
sublevels for levelup
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.gitignore
History.md
Makefile
Readme.md
example.js
index.js
package.json

Readme.md

sublevel

sublevels for levelup

Installation

npm install sublevel

Example

var level = require('level');
var sublevel = require('sublevel');

// create a sublevel by passing a level `db` instance
var db = level('/tmp/level');
var items = sublevel(db, 'items');

items.put('foo', 'bar', function(err){
  items.get('foo', function(err, data){
    console.log(data); // => 'bar'
  });
});

// create deeper sublevels by passing the parent
var posts = sublevel(items, 'posts');

// or alternatively by calling `.sublevel()`
var comments = posts.sublevel('comments');

API

The following methods are compatible with a level db:

put, get, del, batch, createReadStream, createKeyStream, createValueStream, createWriteStream

Sub(db[, path][, options])

Creates a new sublevel under db.

Sub#sublevel(path[, options])

Creates a new sublevel under this.

License

MIT

Something went wrong with that request. Please try again.