You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Introduction

  • Node.js® is an open-source, cross-platform JavaScript runtime environment and is a frequently used scripting language available for Linux, MacOS, Windows, and other platforms.
  • This article explains how to syntactically include Node.js® scripts with JS7 job scripts.

Unix

  • Find the below examples for download (.json upload)run-Node.js-unix.workflow.json
  • In order to directly run Node.js® script code from a JS7 shell job script the recommended approach is to use a shebang like this:
    Example how run Node.js® script code with a shebang

  • 1
    2
    3
    4

    #!/usr/bin/node

     var name =(process.env.name);
     var num = parseInt(process.env.num) ;

    //print value of variable   
    console.log( name);
    console.log( num);

    Node.js® script can be executed from a file that has to be located by the executing Agent:
    Example how to run PowerShell® script code from a file

    1

    node  /home/{User}/JS7-2.5.1/some_Node.js

Windows

  • Find the below examples for download (.json upload)run-Node.js-windows.workflow.json
  • In order to directly run Node.js® script code from a JS7 shell job script the recommended approach is to use a shebang replacement like this:
    Example how run PowerShell® script code with a shebang replacement

    1
    2
    3
    4

    @@findstr/v "^@@f.*&" "%~f0"|node.exe -&goto:eof
     


  • Last but not least a PowerShell® script can be executed from a file that has to be located by the executing Agent:

    Example how to run Node.js® script code from a file
    node.exe C:\Users\Documents\Test.js
  • No labels