Meet npm Pro: unlimited public & private packages + package-based permissions.Learn more »

@node-wot/td-tools

0.7.0-SNAPSHOT.5 • Public • Published

TD (ThingDescription) tools of node-wot

Getting Started

In the following example it is shown how td-tools of node-wot can be used.

Prerequisites

  • npm install @node-wot/td-tools

Example

The example parses a TD and also serializes yet another newly created TD.

node example.js

// example.js
TDTools = require("@node-wot/td-tools");
Thing = require("@node-wot/td-tools").Thing;


// parse TD
let tdString = JSON.stringify({
    id : "123",
    title: "MyThing"
});
let dd = TDTools.parseTD(tdString);
console.log("**** PARSED TD ****");
console.log(dd);
console.log("****");


// init Thing and serialize to TD
let thing = new Thing();
thing.id = "789";
thing["@type"] = "Thing";
thing.support = "foo@example.com"
thing.properties = {
    "myProp" : {
        type: "integer"
    }
}
let tdString2 = TDTools.serializeTD(thing);
console.log("**** SERIALIZED TD ****");
console.log(tdString2);
console.log("****");

More Details

see https://github.com/eclipse/thingweb.node-wot/

Keywords

none

Install

npm i @node-wot/td-tools

DownloadsWeekly Downloads

101

Version

0.7.0-SNAPSHOT.5

License

EPL-2.0 OR W3C-20150513

Unpacked Size

63.6 kB

Total Files

27

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar