node-red-contrib-function-npm 0.4.3

A function node for Node-RED with npm load capabilities

npm install node-red-contrib-function-npm

node-red-contrib-function-npm

Node red function node with capability to install and use packages from npm

Compatability

node-red version > 1.0

Install

From your node-red directory

npm install node-red-contrib-function-npm

Usage

The function-npm node behaves like a normal function node, with the exception of allowing the use of npm modules within the script inside the block. It scans the script for any require statements and downloads the modules specified in the require statements. The module is automatically cleaned from the disk when the node-red process closes.

//syntax to install a specific version
var lowerCase = require('[email protected]')

//if no version specified the latest version is installed
var uc = require('upper-case');

msg.payload = {             
    upper: uc.upperCase('Hello World'),
    lower: lowerCase('Hello World')
} ;
return msg;

Project Info

URLs

Name Link
Github Repo https://github.com/ntsaini/node-red-contrib-function-npm
NPM Package https://www.npmjs.com/package/node-red-contrib-function-npm

Contributions

If you'd like to contribute to this project, feel invited to commit to this repository!

License

This work is licensed under the Apache License, Version 2.0.

Credits

Project : node-red-contrib-npm (https://github.com/jthomas/node-red-contrib-npm)
License : MIT License
Author  : James Thomas

For providing the inspiration of the idea and code for installing npm packages dynamically
Project : node-red (https://github.com/node-red/node-red/blob/master/packages/node_modules/%40node-red/nodes/core/function/10-function.js)
License : Apache License 2.0
Author  : Node-RED team

For the base function node code.

Node Info

Version: 0.4.3
Updated 2 years, 7 months ago
License: Apache-2.0
Rating: 5.0 2

Categories

Actions

Rate:

Downloads

73 in the last week

Nodes

  • function-npm

Keywords

  • function-npm
  • node-red

Maintainers