Skip to content

Feature: accept all data formats, not just JSON #18

@vvo

Description

@vvo

Sorry to spam you with issues but.

Why not accept all data formats in zkplus?

One thing that blocked me was that I wanted to store some text into /a/node and it failed because I had to wrap it with JSON.

Default data format should be to store object as they are.

If you want to use JSON you should be able to do like nconf do:

The file store is also extensible for multiple file formats, defaulting to JSON. To use a custom format, simply pass a format object to the .use() method. This object must have .parse() and .stringify() methods just like the native JSON object.

I don't think we should default to JSON even if it's the current way of operating of zkplus.
It's not obvious that node-zkplus is working with only-json as when you're using node-zookeeper you just store what you want in the format you want.

var zk = zkplus({
                 servers: [],
                 format: {
                     parse: JSON.parse,
                     stringify: JSON.stringify
                   }
                });

What do you think?

I can do this, but then we should bump to a major version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions