Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

etcd

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

etcd

etcd client for node

  • 0.0.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
7
Maintainers
2
Weekly downloads
 
Created
Source

etcd-node

An alternative client library for interacting with etcd from node.js (without coffeescrpt). If you don't mind having coffeescript dependencies, there is already is a module for that.

Notice

This is not stable at all! I am writing this module as I learn more about etcd, feel free to help!

Install

$ npm install etcd

Configuring.

I made the client a singleton for the time being (up for suggestions). If you need to set host or port, use the configure method.

var etcd = require('etcd');

etcd.configure({
  host: '127.0.0.1',
  port: 40001
});

NOTE: I still need to add SSL support.

Commands

I am still implementing commands, but here is what we have so far:

.set(string, mixed, [options], [callback])

etcd.set('hello', 'world', function (err) {
  if (err) throw err;
});

Set with a TTL:

etcd.set('hello', 'world', { ttl: 5 }, function (err) {
  if (err) throw err;
});

Set using a "setAndTest":

etcd.set('hello', 'world', { prev: 'world' }, function (err) {
  if (err) throw err;
});

.get(string, [callback])

etcd.get('hello', function (err, result) {
  if (err) throw err;
  assert(result.value);
});

.del(string, [callback])

etcd.del('hello', function (err) {
  if (err) throw err;
});

.list(string, [callback])

etcd.list('prefix', function (err, items) {
  if (err) throw err;
});

.watch(string, [callback])

etcd.watch('prefix', function (err) {
  if (err) throw err;
});

.machines(callback)

etcd.machines(function (err, list) {
  if (err) throw err;
});

.leader(callback)

etcd.leader(function (err, host) {
  if (err) throw err;
});

TODO

  • encoding (json|string)

License

MIT

Keywords

FAQs

Package last updated on 16 Oct 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc