creator.js 537 Bytes
'use strict';

const zookeeper = require('node-zookeeper-client');

module.exports = (server, path) => {
    const client = zookeeper.createClient(server);

    client.once('connected', () => {
        client.mkdirp(path, new Buffer('false'), (err, path) => {
            if (err) {
                console.log('Node %s create err', path, err.stack);
            } else {
                console.log('Node %s is created', path);
            }

            client.close();
        });
    });

    client.connect();
};