namespaces for levelup
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.travis.yml
README.md
namespace.js
package.json

README.md

#DEPRECATED

Yo! level-sublevel is much more capable than this, so use that instead!

level-namespacebuild status

namespaces for levelup

Usage/demo

var namespace = require('level-namespace');
namespace(db);

var namespace = db.namespace('example');

// most of the levelup-methods are supported
namespace.put('foo', 'bar', function(err) {
    if (err) throw err;

    namespace.get('foo', function(err, value) {
        assert.equal(value, 'bar');
    });

    db.get('example:foo', function(err, value) {
        assert.equal(value, 'bar');
    });
});

db.batch([
        { type: 'put', key: 'foo', value: 'baz' },
        { type: 'put', key: 'example:foo', value: 'bar' },
        { type: 'put', key: 'example:hello', value: 'world' },
        { type: 'put', key: 'example;hello', value: 'worldz' }
    ], function() {
        // will print
        // 'bar' and then 'world' to process.stdout
        namespace.valueStream().pipe(process.stdout)
        // namespace also support valueStream, readStream & writeStream also
    }
)

Licence

MIT