You could use enigma, qsocks and one of the other libraries. The most straight forward way I have found however is to simply use ws.
const WebSocket = require('ws');
const ws = new WebSocket('ws://localhost:4848/app/engineData');
// create a new session:
ws.on('open', function open() {
ws.send(JSON.stringify({
"handle": -1,
"method": "GetDocList",
"params": {}
}), function(data, err) {
console.log('returned data ', data);
});
});
This way allows you to copy paste out of the engine explorer and get on with your life!!