New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

netcd

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

netcd

netcd is the official node.js client for etcd v3.

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

netcd

netcd is the official node.js client for etcd v3.

Usage

import {Netcd, Metadata} from 'netcd'
// create client using endpoints
const netcd = new Netcd({
  endpoints:['127.0.0.1:2379']
})
const key = Buffer.from("test_key").toString('base64')
const value = "test_value"
const authClient = netcd.getClient('Auth')
authClient.Authenticate({"name": "root", "password": "a123456"},(err,authData)=>{
    const client = netcd.getClient('KV')

    // auth
    const meta = new Metadata()
    meta.add('Authorization', authData.token);

    client.Put({key:btoa('test_key'),value},meta,(err,data)=>{
        console.log(err,data)
    })

    // get the key
    client.Range({key:btoa('test_key'),rangeEnd:btoa('test_key')},meta,(err,data)=>{
        console.log(err,data)
    })

    // delete the key
    client.DeleteRange({key:btoa('test_key')},meta,(err,data)=>{
        console.log(err,data)
    })
})

For full etcd v3 API, plesase refer to the official API documentation.

Keywords

etcd

FAQs

Package last updated on 29 Oct 2022

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