npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

level-lazy-db

1.2.0

@mafintosh

npmHomeRepoSnykSocket
Downloads:0
$ npm install level-lazy-db
DailyWeeklyMonthlyYearly

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