11. May 2013

Edge – invoke PowerShell from NodeJS

Project Edge allows seamless integration of NodeJS and PowrShell.

Just install packages:

npm install edge
npm install edge-ps

Create NodeJS application which contains PowerShell code:

var edge = require('edge');

var hello = edge.func('ps', function () {/*
"PowerShell welcomes $inputFromJS on $(Get-Date)"
*/});

hello('Node.js', function (error, result) {
 if (error) throw error;
 console.log(result[0]);
});

Start application and you’ll get output

PowerShell welcomes Node.js on 05/11/2013 07:14:38

Project Edge also allows integration of NodeJS with other technologies (e.g. Python)