There a several ways that you can copy nodes and flows between flows.
They are:
- Select Copy and Paste
- Export and Import Clipboard
- Save to and Retrieve from the local library
Select Copy and Paste
Just select the nodes that you want to copy then control + C
and control + V
.
Export and Import Clipboard
Just select the nodes that you want to export and click the export and then open a text to store the flow on the clipboard with the flow as its file extension. After this, I can take that text document and I can install it on another node-red installation on another computer. It's a very good way of exporting your flows to other computers to other users.
To get a flow that's been exported into your node-red flow, all you do is use the opposite which is the import. Go to import and import from the clipboard. Open the text document then copy the stored flow to the clipboard and import.
Save to and Retrieve from the local library
The third method is by using the library. Using the library you can actually copy flows and you can also copy individual functions. We're going to look at doing both.
Just select the nodes and then go to export and this time I'm exporting into the library not clipboard. And I need to give it a name, I can also give it a subdirectory. By default, they're stored in the library folder. The flows are stored in a subfolder called flows and the functions in a subfolder called functions.
The main difference between exporting it to the library or exporting it to the clipboard and then to a text file is the library used when you want to reuse the flows and functions on the same machine. The clipboard and the file issues when you actually want to transfer the two flows to a different machine or a different user.
flows
fuctions
If you want to override the function in the libraries, just open the function and edit it and then save it as the same file. It will override the original one. It's important to realize that once you've imported the function into the function node then it's stored in that function node. If you go back and change the library, the function in the library doesn't actually change the one you've already imported into a flow. So you'd have to re-import it back into the flow if you wanted to pick up the changes in the library that you've made.
In the end, this is the node-red directory on my machine, and you can see the lib folder, go to folder you can see those two folders there one called flows one called functions. They were created by the system.