0.0.3 • Published 5 years ago

@uq-elipse/uq-eait-kvd v0.0.3

Weekly downloads
5
License
MIT
Repository
-
Last release
5 years ago

uq-eait-kvd

Client for communicating with UQ EAIT's KVD system

Installation

npm i @uq-elipse/uq-eait-kvd

Usage

/// Importing

// ES Modules style
import { KVD } from "@uq-elipse/uq-eait-kvd";

// CommonJS style
const KVD = require("@uq-elipse/uq-eait-kvd").KVD;


/// In your code...

// Initialise the KVD client with the default EAIT KVD server IP and port
const kvdClient = new KVD();

// You can perform a REQUEST operation like this:
kvdClient.request("3nwAoSEmnbmXJC5ExlEatxyk63F7bY2M")
    .then((buffer) => {
        // You are responsible for decoding the buffer yourself
        // For example, we expect JSON here, so:
        const data = JSON.parse(buffer.toString("utf8"));
    })
    .catch((e) => {
        // Note that if the request times out, an error is thrown, and it is up
        // to you to send the message again
        console.error(e);
    });

Background

The KVD system is described in more detail in the following links: