Dynamically create/run function node

Dear nodered users,

I am actually creating a program where the users will create a text file based code of any javascript code, and this file will be loaded on our nodered.

Is there anyway to run that pre-created javascript code into a function node? I tried the EVAL function, but this code is not efficient and slow.
I hope there are some ways where I can dynamically create a function in nodered in a more efficient way ( what do I mean by efficient is, it is running like it was created in a function node )

Hopefully you can help me.

Thanks nodered commununity!

Cheers!

There are a couple of old nodes https://flows.nodered.org/search?term=file-function&type=node&type=flow&type=collection that allow you to use external files to load functions...

But then again - I would be very wary of letting any random user code be able to be executed unless you are going to sanitise it all for bad actions. This is why things like exec are really not a good idea.

1 Like

Thanks dceejay! Never knew about this! :slightly_smiling_face:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.