let's say I have some Javascript code living on a webserver that has this code:
export const runCommand = (args) => {
}
Now in my Node.js app, I'd like to some how download this remote file and import the runCommand function. I've tried looking into the VM Contexts however I was only successful at executing the code if it was called in that remote file.
In this situation, I would like to download the code, get the runCommand function, and then invoke it in my app whenever I want to. Is this possible?
i am assuming you know the path to the remote command JS file you want to import. As such, I would reference this topic, and it should help with the URL-based file access:
if you don't know the path, then it's a different problem.