npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

linkedge-core-sdk

v0.1.0

Published

Link IoT Edge core sdk for Node.js.

Downloads

6

Readme

Link IoT Edge Core SDK for Node.js

The package allows developers to write functions on Function Compute using JavaScript, which running within Link IoT Edge.

Installation

npm install linkedge-core-sdk

or you can copy this project directly to your function's node_modules directory.

Althrough the library is built into Link IoT Edge, we recommand that you install it locally as it improves the development experience, especially when developing with IDE.

Example

Here is a examle demonstrates publishing messages to a topic.

const leSdk = require('linkedge-core-sdk');

const iotData = new leSdk.IoTData();
const message = {
  topic: '/hello/world',
  payload: 'Hello World! Sent from Link IoT Edge using Node.js.',
};
iotData.publish(message, (err) => {
  if (err) console.log(err);
});

APIs


IoTData.publish(params, callback)

Publishes messages.

The parameters are:

  • params: params object,which contains:
    • topic: {String} (Required) the topic name to be published.
    • payload: {String|Buffer} (Required) the message payload in string or in binary.
  • callback(err): a callback function for receiving result, which follows the standard JS practice of setting the first parameter as an error.

IoTData.getThingProperties(params, callback)

Obtains specific properties of a thing.

The parameters are:

  • params: params object,which contains:
    • productKey: {String} (Required) the productKey of the target thing from which to get properties.
    • deviceName: {String} (Required) the deviceName of the target thing from which to get properties.
    • payload: {Array} (Required) a list of keys that specifies the properties to be obtained.
  • callback(err, data): a callback function for receiving result, which follows the standard JS practice of setting the first parameter as an error and the second parameter as the result object.

IoTData.setThingProperties(params, callback)

Updates the properties of a thing.

The parameters are:

  • params: params object,which contains:
    • productKey: {String} (Required) the productKey of the target thing to which to set properties.
    • deviceName: {String} (Required) the deviceName of the target thing to which to set properties.
    • payload: {Object} (Required) a object consisting of keys and values that specifies the properties to be updated.
  • callback(err): a callback function for receiving result, which follows the standard JS practice of setting the first parameter as an error.

IoTData.callThingService(params, callback)

Calls a specific service of a thing.

The parameters are:

  • params: params object,which contains:
    • productKey: {String} (Required) the productKey of the target thing of which to call a service.
    • deviceName: {String} (Required) the deviceName of the target thing of which to call a service.
    • service: {String} (Required) the name of the service to be called.
    • payload: {String|Buffer} a optional string or binary in JSON that you provided to the service as arguments.
    • callback(err, [data]): a callback function for receiving result, which follows the standard JS practice of setting the first parameter as an error and the second parameter as the result object.

IoTData.getThingsWithTags(params, callback)

Obtains a list of thing objects, each of which being with all given tags.

The parameters are:

  • params: params object,which contains:
    • payload: {Array} (Required) a list of tag that consisting of {key: value}.
  • callback: a callback function for receiving result, which follows the standard JS practice of setting the first parameter as an error and the second parameter as a list of thing objects.

FCClient.invokeFunction(params, callback)

Invokes a specific function.

The parameters are:

  • params: params object,which contains:
    • functionId: {String} (Required) the id of the function to be invoked. Function name is not supported currently.
    • invocaionType: {String} a optional type of the invocation, may be Sync or Async. It will be Sync if not specified.
    • invokerContext: {String} a optional invoker-specific information to the invoked function. The invoker information will be passed into the function, and can be choosed through context variable. It must be base64-encoded.
    • payload: {String|Buffer} a optional string or binary data that you want to provide to the function as input.
  • callback: a callback function for receiving result, which follows the standard JS practice of setting the first parameter as an error and the second parameter as the result object.

License

Apache 2.0