Open serapath opened 9 years ago
did you dat init
in the ./test
folder?
nope, i wasn't aware that i need dat
to use dat-core
.
I just tried an npm install dat -g
, but ran into problems during installation. npm install dat
fails too.
Maybe I can post that on the dat
repo instead?
npm --version
=> 3.1.2node --version
=> v2.3.4@serapath you can call db.init
from dat-core: https://github.com/maxogden/dat-core#dbinitcb, i think thats what @mafintosh meant
Hm, probably I'm doing something stupid.
// [./index.js]
var dat = require('dat-core');
var db = dat('./test');
db.init(function(){console.log(arguments);});
$> node index.js
events.js:141 throw er; // Unhandled 'error' event ^ Error: No dat here ...
But var db = dat('./test')
throws anyway.
I now solved it by writing:
var dat = require('dat-core');
var db = dat('./test', {createIfMissing:true});
I'm not sure if that's how it's meant to be, but if so, then an update of the usage example might be helpful.
Ah yea. init should probably do that for you. I'll do a fix for that
how about this? https://github.com/maxogden/dat-core/pull/30
Do I need to pass in a leveldb? The readme says something about
I do
and get