How to call the interface of the export function in nodered

Hello everyone.
I want to use the "export" function in the upper right corner of nodered, where is this function and how to call it?

Hi @lei1

you can open the export dialog using the code:


Thanks, how to call this function in the function node, get the information of the node and print it to the console

A Function node cannot call this function.

The Function node runs in the runtime part of node-red. The export dialog is in the editor.

Can you describe in more detail what you are trying to do and where you want the code to run?

How to automatically collect all node information and print it to the console, (define a function node to do this instead of manually clicking the export button in the upper right corner)

The content of the export is the content of the flows.json file which you can find in you nodered folder under the name flows_yourhostname.json.
To get the content of this file into nodered you can use a file in node.
For example on a raspberry pi in the stock configuration if nodered was installed with the standard install script put /home/pi/.node-red/flows_raspberrypi.json in the file in node and you will get the whole content.


For example, in a process, three different nodes are deployed to form a process, how to automatically obtain the json information of this process through the fourth node and print it to the console

There is no `easy way to do this. However here is a possible solution. First you would have to have to create a dummy file, maybe call it ‘previous.flow’. Next you would need an inject node set to run when ever you do a deploy. This would be connect to a file node that would read the current flow file.

Now you have access to the old flow and new flow, you would have to do a comparison of the two and send the differences to the console. I’d suggest you change the settings.js to save the flows in a form that is easier to read. See Settings file : Node-RED

Thank you so much

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