Execute a Node.js script.

This task is deprecated, please use the io.kestra.plugin.scripts.node.Script or io.kestra.plugin.scripts.node.Commands task instead.

With the Node task, you can execute a full JavaScript script. The task will create a temporary folder for each task, and allows you to install some npm packages defined in an optional package.json file.

By convention, you need to define at least a main.js file in inputFiles that will be the script used. You can also add as many JavaScript files as you need in inputFiles.

The outputs & metrics from your Node.js script can be used by others tasks. In order to make things easy, we inject a node package directly on the working directory.Here is an example usage:

javascript
const Kestra = require("./kestra");
Kestra.outputs({test: 'value', int: 2, bool: true, float: 3.65});
Kestra.counter('count', 1, {tag1: 'i', tag2: 'win'});
Kestra.timer('timer1', (callback) => { setTimeout(callback, 1000) }, {tag1: 'i', tag2: 'lost'});
Kestra.timer('timer2', 2.12, {tag1: 'i', tag2: 'destroy'});
yaml
type: "io.kestra.core.tasks.scripts.Node"