Display Data from MySQL without uibuilder

The generic file read nodes in Node-RED do not, I believe care about individual lines, they just read the whole file.

I don't think the node.js fs library will pull an individual line either. However, there are certainly node.js packages that will probably do what you want - linereader for example? Look on npmjs.org.

I was looking at linereader earlier. It looks like it will do what I want, but how to use it in Node Red is documentation that's missing. What they show on npmjs.org doesn't work. This doesn't work, either: https://stackabuse.com/reading-a-file-line-by-line-in-node-js/

Time for me to clock out for the day and go home. I'll go back to pulling what little of my hair I have left out tomorrow.

This section of the Writing Functions page tells you how you can use the new FunctionExternalModules feature to pull in external code to use in a Function node.

Most of that looks like it will work to me.

It does, but then I get errors for "require" not being defined and stuff like that.

I'll play with it again on Saturday when I go back to work. I'll probably end up just writing and calling a Python script to get the data I need. I'd have been done with this a long time ago had I done that in the first place.

You can add require to the globals using the settings.js file. Then you can do a global.get('require') at the top of your function node.

Of course, as colin points out, you can require things in function nodes without going through that now if you are using the latest version of Node-RED.

I got it doing what I needed using python3-function. It was far more straightforward than Javascript.

Thank you for the help! This problem is resolved.

Chris

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