Skip to content

Conversation

@h2jorm
Copy link

@h2jorm h2jorm commented Mar 14, 2019

This is a nice zookeeper library. However, compared to promise, the callback style is not coding friendly today. Some issues or pull requests are related to promise API. For example, #47 #58 #87 .

I have made the following methods promise supported.

  • Client.create
  • Client.remove
  • Client.exists
  • Client.getChildren
  • Client.getData
  • Client.setData
  • Client.getACL
  • Client.setACL
  • Client.mkdirp
  • Transaction.commit

Example

zookeeper.create('/a', Buffer.from('hello'))
    .then((path) => {
        assert(path === '/a');
    }, (err) => {
        console.log(err);
    });

This PR does not add new methods and backward compatible. In general, the methods above will return a promise if they fail to receive a callback function as the last parameter.

@h2jorm h2jorm force-pushed the feature/promisify branch from 118a523 to cc7dd15 Compare March 14, 2019 07:23
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.

1 participant