0.0.1 • Published 10 years ago

zenstorejs v0.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
10 years ago

#zenstorejs

zenstorejs is the npm package for zenstore. And it is very easy to use:

// example: store something
zenstorejs.store('http://localhost:1337/e90f161ac64790b7dbe155201ff4765a7a0de4c9',
                 JSON.stringify({
                   mytest: 1
                 }),
                 function (err, ret) {
                   zenstorejs.get('http://localhost:1337/e90f161ac64790b7dbe155201ff4765a7a0de4c9', function (err, ret2) {
                     t.equal(ret, ret2);
                     t.equal(ret, JSON.stringify({mytest: 1}));
                     t.end();
                   });
                 });

// example: writing via pipe
zenstorejs.createWritePipe('http://localhost:1337/e90f161ac64790b7dbe155201ff4765a7a0de4c9', function (zenPipe) {
  zenPipe.write('{"testtest": 123}');
});

// example: listining on a zenstore storage 
zenstorejs.follow(argv.follow, argv.at, function (stream) {
  stream.on('data', function (data) {
    console.log('->'.bold.blue + ' received data:'.blue, data.toString().grey);
  });
});

BTW: Have you looked at zenstorecli?

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago