Venemo / node-lmdb

Node.js binding for lmdb
MIT License
361 stars 71 forks source link

get current cursor as binary #55

Closed russtee closed 8 years ago

russtee commented 8 years ago

Imdb dbs created by other modules (e.g. rvagg) store their cursors as binary data.

For our importing script I was attempting to get around this by casting the string cursors from node-lmdb to binary and then to utf8, this works some of the time but always leads to corruption.

A simple function to getTheCurrentCursorAsBinary would seem to get around this.

We hacked together a fix as such and it's working for us so far.

Venemo commented 8 years ago

It is unclear what exactly you are asking here.

Sorry, but I don't know what you mean by store their cursors as binary data. If you mean that the keys are binaries, we are already talking about that in issue #47, and if you mean that the data is a binary, you can use getCurrentBinary.

russtee commented 8 years ago

Sorry, yes, rvagg's lib stores keys as binary/utf8 and so accessing them using node-lmdb is impossible.

Whilst this is covered by [https://github.com/Venemo/node-lmdb/issues/47] the soluton in this specific case is a subset and much simpler in that all is needed is a function to access the key at the current cursor in its binary form. It wouldn't be necessary to re-architect everything to use binary keys.

Venemo commented 8 years ago

Okay, so let's cover this in #47 - I already know how I'll do it, don't worry. :)

russtee commented 8 years ago

Great stuff. Will really help.

Sent from my iPhone

On 1 Mar 2016, at 18:49, Timur Kristóf notifications@github.com<mailto:notifications@github.com> wrote:

Okay, so let's cover this in #47https://github.com/Venemo/node-lmdb/issues/47 - I already know how I'll do it, don't worry. :)

— Reply to this email directly or view it on GitHubhttps://github.com/Venemo/node-lmdb/issues/55#issuecomment-190849461.

Russell Irwin @ Telemetry Co-Founder and Director Ext 787 New York +1 212 380 6666 London +44 (0)20 7148 7777 http://www.telemetry.com The Digital Media Forensics Company