creator.js 532 Bytes
'use strict';

import zookeeper from '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();
};