level-lazy-db

1.2.0 • Public • Published

level-lazy-db

Open leveldb only when you need to

npm install level-lazy-db

build status

Usage

Simply pass a function the calls it callback with a levelup instance. The method will only be called once and only when you call a io method on the db.

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

var db = lazy(function(cb) {
	cb(null, level('/tmp/my.db'));
});

db.get('test', function(err, val) {
	// calling a method opens the db
});

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i level-lazy-db

Weekly Downloads

3

Version

1.2.0

License

none

Last publish

Collaborators

  • mafintosh