Node red: how to read a file from within a function

hi,

I know there is a readFile node, but I’d like to read a file as part of a function node.
I seem to be unable to find any info on that.
does anyone have an example to get me started?

thanks,
wolfgang

My first reaction is - just don’t. The whole point of Node Red is to combine small well-tested components that each do only one operation.

Also, the code within the function node is single-threaded and will block execution.

Why is it that you don’t want to use the “read file” node?

Thanks for your answer.
I am working on an algorithm that decides how to charge a home battery depending on multiple parameters and thought it might be cleaner (for me) to keep all the work inside this one function, but yes, I can do the reading and writing via nodes.