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

Pluggable adapter/encoder api [feature idea] #157

Open
m-onz opened this issue Jan 23, 2019 · 1 comment
Open

Pluggable adapter/encoder api [feature idea] #157

m-onz opened this issue Jan 23, 2019 · 1 comment

Comments

@m-onz
Copy link

m-onz commented Jan 23, 2019

This is more a feature request / proposal... it would be nice if there was neat way to apply a transformation on incoming and outgoing data.

var hyperdb = require('hyperdb')

var db = hyperdb()

// pass through
db.setEncoder(function (input) { return input })
db.setDecoder(function (input) { return input })

The idea is that those functions are called before any data is inserted or retrieved (before the data is returned from streams and callbacks).

There may already be a nice way to do this stuff, and the API is just a proposal at this stage. All comments and thoughts welcome!

@m-onz
Copy link
Author

m-onz commented Jan 24, 2019

I made a library to suit my needs: https://github.com/m-onz/hyperdb-plug-socket ... it only supports get/put/createReadStream... (thats all i need for now). It would be possible to use javascript Proxies or something more complicated.

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

1 participant