You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
815 B
34 lines
815 B
/** |
|
* Copyright (c) 2013 Yahoo! Inc. All rights reserved. |
|
* |
|
* Copyrights licensed under the MIT License. See the accompanying LICENSE file |
|
* for terms. |
|
*/ |
|
|
|
var zookeeper = require('../index.js'); |
|
|
|
var client = zookeeper.createClient(process.argv[2], { retries : 2 }); |
|
var path = process.argv[3]; |
|
var data = new Buffer(process.argv[4]); |
|
|
|
client.once('connected', function () { |
|
console.log('Connected to the server.'); |
|
|
|
client.setData(path, data, function (error, stat) { |
|
if (error) { |
|
console.log('Got error when setting data: ' + error); |
|
return; |
|
} |
|
|
|
console.log( |
|
'Set data "%s" on node %s, version: %d.', |
|
data.toString(), |
|
path, |
|
stat.version |
|
); |
|
client.close(); |
|
}); |
|
}); |
|
|
|
client.connect(); |
|
|
|
|