Level / memdown

In-memory abstract-leveldown store for Node.js and browsers.
MIT License
287 stars 37 forks source link

Won't open #5

Closed 19h closed 11 years ago

19h commented 11 years ago
    */node_modules/levelup/lib/levelup.js:103
      db.open(this.options, function (err) {
         ^
    TypeError: Cannot call method 'open' of undefined
        at LevelUP.open (*/node_modules/levelup/lib/levelup.js:103:6)
        at new LevelUP (*/node_modules/levelup/lib/levelup.js:73:8)
        at LevelUP (*/node_modules/levelup/lib/levelup.js:44:12)
        at worker (*:239:33)
        at Object.<anonymous> (*:690:2)
        at Module._compile (module.js:456:26)
        at Object.Module._extensions..js (module.js:474:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Function.Module.runMain (module.js:497:10)

Not sure if it's a recession, but it fails to open.

    require('levelup')("", {
        db: function(location) {
            return new require('memdown')(location)
        }
    });
rvagg commented 11 years ago

yeah, I haven't bothered putting a self-instantiating constructor on MemDOWN, that's on my TODO, you have to actually instantiate it, see the docs:

factory = function (location) { return new MemDOWN(location) }
rvagg commented 11 years ago

fixicated, your code should work fine now, in fact you should just have to do db: require('memdown') now.