Function node js using require module

Hi,

How do I use node module libraries?

For example:
If I do var fs = require('fs'); I get a require not defined.

Have looked around online it says adding functionExternalModules: true, in settings.json. But still not working. Is it because node-red is running on Connect Automate and automate is not allowing this feature to work?

Thank in advanced
Regards
E

Hi Edanting,

You can configure Node.js modules in the Setup tab of the Function node. There is no need to make changes to settings.json .

Please note that we cannot provide support for individual third-party node modules, but this is still a very powerful option.

Here is an example from one of my test flows, where I load the uuid module:

I noticed you are referring to fs . For file and folder operations, we developed a dedicated package that may already provide what you need. It includes folder capture, folder listing, file operations, and folder operations.

Erik

Works a treat! Thanks Erik.