Closed alessioalex closed 11 years ago
That's an encoding issue, since lev expects json encodings and tries to JSON.parse
something that isn't JSON.
I think this has to do with the key cache, @hij1nx?
For now just pass --encoding=utf8
and everything should work.
yep. its the key cache, we need a way to handle key caching for multiple encodings
Maybe we can make levelup handle json encodings like this:
try { return JSON.stringify(value); }
catch (e) { return value; }
So invalid JSON will just be a string.
levelup 0.9 will have the possibility to specify encodings for streams too, so we'll be able to do:
db.createReadStream({ encoding : 'utf8' }).pipe(through(function (data) {
try {
this.queue(JSON.parse(data));
} catch (e) {
this.queue(data);
}
}));
That at least won't break lev
with the default JSON encoding.
ah! this is a great idea!
this should work now.
The db is ok, because I write / read data to it and everything works fine, but cannot get the REPL or actually lev to work (lev --read ..etc).
I'm using Node v0.8.19