setter.js
520 Bytes
'usu strict';
import _ from 'lodash';
import zookeeper from 'node-zookeeper-client';
module.exports = (server, path, val) => new Promise((resolve, reject) => {
const client = zookeeper.createClient(server);
client.once('connected', function () {
client.setData(path, new Buffer(val.toString()), function(err, data, stat) {
console.log('path %s data change to', path, val);
resolve();
client.close();
});
});
client.connect();
});