This project has been abandoned. There will be no further releases. If you wish to revive level-lazy-open
, please open an issue in Level/community
to discuss a way forward. Thank you! ❤️
Lazily open a leveldown compatible backend.
NOTE: This doesn't work with levelup. This can only be useful to you if you're using leveldown directly.
var lazy = require('level-lazy-open');
var down = require('leveldown');
// a function that returns an open backend
function factory(cb){
var db = down('./db');
db.open(function(err){
cb(err, db);
});
}
var db = lazy(factory);
// db is closed and won't be opened, unless
// you do something with it:
db.put('foo', 'bar', function(err){
// db is open now
// you can manually close the db again:
db.close(function(err){
// the end
});
});
// db is opening now
$ npm install level-lazy-open
Create a new abstract-leveldown
compatible db that calls factory
to get a db whenever it hasn't yet and you
perform an operation against it.
Level/lazy-open
is an OPEN Open Source Project. This means that:
Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.
See the Contribution Guide for more details.
To sustain Level
and its activities, become a backer or sponsor on Open Collective. Your logo or avatar will be displayed on our 28+ GitHub repositories, npm packages and (soon) our website. 💖
MIT © 2012-present Contributors.