Is it possible to compose a new node that comprises of several built-in or other nodes?

I would like to abstract multiple built-in or other nodes that are currently available to create one single composite node. In other words, if these built-in/other nodes have UI information that need to be set, I would like to set those values directly from my composite node. The idea is to delegate the processing of a particular task (that is exposed by these other nodes) to these nodes directly (in my composite node).

For example, I want to monitor files from a directory. When ever a new file appears in the directory, I want to parse the records and create json messages for each record. Yet I want to expose all this functionality as a single composite node.

I want to leverage the built-in components 'watch-directory' node to watch for files, 'file in' node to read the file content and generate message for each record, 'csv' node to transform each record to each json message. Yet I want to hide all of these components under my new composite node to do the actual work.

  1. Is this possible with minimal work?
  2. Is this a good idea or bad idea?
  3. What are the pitfalls?

The typically way of doing that today would be to create a Subflow that incorporates all of the nodes you want, and use subflow properties to let you customise the configuration of the nodes inside the subflow.

https://nodered.org/docs/user-guide/editor/workspace/subflows

1 Like

This is exactly what I am looking for. Thanks.

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