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

Encoding #12

Closed
19h opened this issue May 5, 2013 · 7 comments
Closed

Encoding #12

19h opened this issue May 5, 2013 · 7 comments

Comments

@19h
Copy link

19h commented May 5, 2013

Hey there again!

We should either adapt to LevelDOWN or add an abstraction layer allowing binary as well as non-binary data (f.i. JSON). So either the client specifies the encoding for the .put-process or the server specifies the encoding for all the keys (hammer variant, but makes sense somewhat).

@dominictarr
Copy link
Collaborator

we'll need to rewrite quite several dependencies to get non-json data with multilevel.
@juliangruber has started on some of this work https://github.com/juliangruber/level-rpc

@juliangruber
Copy link
Owner

as of version 4.0.0 multilevel supports binary data! See https://github.com/juliangruber/multilevel/blob/master/test/binary.js for a passing test.

Just set keyEncoding or valueEncoding to binary or whatever else and it will just work.

@feross
Copy link
Contributor

feross commented Aug 14, 2013

Is there a way to set valueEncoding to json or binary one time and have it apply to every db.put call?

LevelUp allows this with:
levelup(dbPath, { valueEncoding: 'json' })

@dominictarr
Copy link
Collaborator

@feross you should set the default encoding when you create the database on the server.

@feross
Copy link
Contributor

feross commented Aug 14, 2013

@dominictarr d'oh! should have figured that out. thanks!

@juliangruber
Copy link
Owner

For api consistency you should also be able to specify the client-specific global encoding in the multilevel client

@juliangruber juliangruber reopened this Aug 14, 2013
@juliangruber
Copy link
Owner

if someone wants this, please go for it :)

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

No branches or pull requests

4 participants