node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org ยป



Provide functionality that can traverse the ZooKeeper hierarchy and read/deserialize thrift-encoded nodes for Node.JS


var zkt = require('node-zookeeper-thrift');

var server = "";

// see zookeeper-thrift/lib/thrift.js for instructions on how to generate thriftClient for your schema
var thriftClient = require('./config/thrift/gen-nodejs/GENERATED_OUTPUT').YOUR_CLASS_NAME;

// associate paths in zookeeper schema to (optional) thrift clients for deserialization
var schema = {
  "/path/to/service/one": {thriftClient: thriftClient},
  "/path/to/service/two": {thriftClient: thriftClient}

// fetch (read and deserialize) all the child nodes of provided schema paths
zkt.fetch(server, schema, function(err, results) {
  if (err) {
    console.log("ERROR: ", err);
  } else {
    console.log("RESULT: ", results);