Using 'fs' in the node function

Hi everyone,

I just discover Node-red and I want to use the node "function" to manipulate files and folders with fs object.

I Uncomment this line in the settings.js

//var fs = require("fs");

and try to use

var fs = global.get('fs');

but the variable fs is set to undefined :worried:

Could You help me please, thank You

Hi @lkaiser

this page of the docs explains how to add additional modules to the Function node - https://nodered.org/docs/writing-functions#loading-additional-modules

In short, you have to add them to the functionGlobalContext property in your settings file.

Thank You very much knolleary !

it works very well.
I did not read correctly this section of the docs :roll_eyes: