This package has been deprecated

Author message:

This project has been abandoned. There will be no further releases. If you wish to revive level-lazy-open, please open an issue (https://github.com/Level/community) to discuss a way forward. Thank you!

level-lazy-open

1.0.3 • Public • Published

level-lazy-open

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.

JavaScript Style Guide Backers on Open Collective Sponsors on Open Collective

Example

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

Installation

$ npm install level-lazy-open

API

lazy(factory)

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.

Contributing

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.

Donate

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. 💖

Backers

Open Collective backers

Sponsors

Open Collective sponsors

License

MIT © 2012-present Contributors.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Published

Version History

  • Version
    Downloads (Last 7 Days)
    • Published

Package Sidebar

Install

npm i level-lazy-open

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

11 kB

Total Files

8

Last publish

Collaborators

  • vweevers
  • ralphtheninja