Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support new levelup encoding pattern #6

Merged
merged 3 commits into from Aug 15, 2013

Conversation

dominictarr
Copy link
Collaborator

in the next release, levelup will support custom encodings.

Level/levelup#149

this pull request means that bytewise can be dropped in to an encoding field as a custom encoding.

levelup(path, {keyEncoding: require('bytewise'), valueEncoding: 'binary'})

The important addition is buffer: true which tells levelup to retrive a binary value when doing a read to a custom encoded field.

Also, I've added bytewise-hex encoding:

levelup(path, {keyEncoding: require('bytewise/hex'), valueEncoding: 'binary'})

this is only a few extra lines, but if you need a string, then you need hex.
(base64 is not useful, because order is not consistent)

Currently, this is needed for sublevel - however, soon I will refactor sublevel to support binary keyEncodings.

deanlandolt added a commit that referenced this pull request Aug 15, 2013
support new levelup encoding pattern
@deanlandolt deanlandolt merged commit b4c3e6c into deanlandolt:master Aug 15, 2013
@deanlandolt
Copy link
Owner

Thanks for the awesome commit, @dominictarr!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants