This is a module for Node.js that will let you run console commands redirecting the input, output and error streams, directly to the console, and also in synchronous code.
Download the repository from NPM. To do it, type from the command line:
npm install -s execute-command-sync
Import in your code the module:
const executeCommand = ;
Start using the command like this:
;// You can do things here after the execution has finished// The results will be logged in the console
Take into account that the output, the error and the input streams are not catchable. To do this, there are more advanced packages out there, like this one: exec-plan.
This module is just a wrapper for this answer at StackOverflow:
Thanks to the great developers that are on StackOverflow, helping every day to do our life a bit easier. Their wisdom is always an honor.