Its an online programming ide for the compilation of simple programs, Mostly used in competitive programming servers to run the code according to certain set of rules.
npm install code-runner
- To run
C
orC++
code in the module you must havegcc
installed in your system. - To run
python
code you must havepython
installed in your system.
var runner = require('code-runner');
runner(code,options,function(err,data){
//callback function
...
});
code
is the code to be executed.options
is an object which should contain the following properties :timeout
: time in ms, specifies the time after which the program must be terminated.language
: the name of the language of the given code.
err
is the error passed to the callback function if there is an error while calling the function.data
is the output passed to the callback function which contains the propertyerror
: error while executing the code.total
: output of the code that ran.