importing javascript modules

62 views
Skip to first unread message

Ted L

unread,
Jan 25, 2024, 1:45:18 PMJan 25
to CommandFusion Software
I am hoping to send some commands purely through javascript. The code I've written works in my debugger but not when I add it to commandfusion. I'm assuming it has something to do with not properly importing the JS module I'm using.

Here's an example of a function:

let net = require( 'node:net');

function take() {
   var socket = net.createConnection (4647, '192.168.71.71');
   console.log('Socket created.'); socket.on('data', function(data) {
   console.log('RESPONSE: ' + data);
   }).on('connect', function() {
   socket write('TA');
   }).on('end', function() {
   console. log('DONE');
   });
}

Is it even possible to use the modules from node? If so what am I doing wrong?
Any help is hugely appreciated.
Reply all
Reply to author
Forward
0 new messages