Create new file

#1

I want to create a new file i using the fs function. I get the following error “ReferenceError: fs is not defined” . I tried that but error persists https://flows.nodered.org/flow/cdf160c36f082dc2a20cd1183ac6cd7d.

0 Likes

#2

Have you followed the instructions in that example flow to add fs to functionGlobalContext in your settings file?

0 Likes

#3

yes do i need to download fs via npm?

0 Likes

#4

fs is a built-in node.js module, you don’t have to install anything else.

I see there is a typo in that example. It sets the fs property in functionGlobalContext, but then in the Function node it does: var fs = global.get('fs1') - note the fs1. That should match the property name set in functionGlobalContext

If you’ve copied that code without checking it, then you’ll have the same typo in your code.

1 Like

#5

Thank you Nick for the constant support in the forums.

0 Likes