# Converting Node-RED flows to UNIX pipes

**URL:** <https://discourse.nodered.org/t/converting-node-red-flows-to-unix-pipes/86590>\
**Category:** General\
**Created:** [20 March 2024 10:58 UTC](https://discourse.nodered.org/t/converting-node-red-flows-to-unix-pipes/86590 "2024-03-20T10:58:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [20 March 2024 10:58 UTC](https://discourse.nodered.org/t/converting-node-red-flows-to-unix-pipes/86590/1 "2024-03-20T10:58:29Z")

</div>

Hi There,

I was thinking about UNIX pipes and the obvious relationship to NR flows, as both are based on flow based programming.

Is there anything that converts NR flows to a UNIX pipes representation? It won't have to create anything that worked but more for educational purposes to demonstrate the relationship between the two.

As a contrived example:

 ![Screenshot 2024-03-20 at 11.49.02](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/9/497fec0aac3eeb9618a0f6bb301bd8c353e48739.png)

would be converted to:

```auto
yes | grep y | head -10 | less

```

Forks in the flow would be a little difficult and would require something like `tee`:

 ![Screenshot 2024-03-20 at 11.54.53](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/e/0e45abd571daea180a61a6aca2e0cab7d04bc5d0.png)

could become something like:

```auto
( yes | grep y | head -10 | tee /tmp/a.txt ) | head -10 | less ; cat /tmp/a.txt | wc -l

```

Going from UNIX pipes to flows would be even more fun!

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [20 March 2024 15:03 UTC](https://discourse.nodered.org/t/converting-node-red-flows-to-unix-pipes/86590/2 "2024-03-20T15:03:40Z")

</div>

Next you will be writing something that converts to/from PowerShell! (which also uses pipes a lot). 😀

Let me know if you do because that could REALLY be useful.

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [20 March 2024 15:31 UTC](https://discourse.nodered.org/t/converting-node-red-flows-to-unix-pipes/86590/3 "2024-03-20T15:31:15Z")

</div>

> [@TotallyInformation](#):
>
> converts to/from PowerShell!

Better still: from NR Flow to UNIX pipe to Powershell pipe - else I would have to support two forms of UNIX pipes 😉

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [20 March 2024 15:31 UTC](https://discourse.nodered.org/t/converting-node-red-flows-to-unix-pipes/86590/4 "2024-03-20T15:31:52Z")

</div>

You are never too old to learn a new Linux command.  
First time I've heard of `yes` (yes, it's `true` 🙃 )

So obviously I used it to discover that my Raspberry Pi Zero Two takes just 15.6 seconds to write one billion times `y \n` to /dev/null

It was the similarity between beautiful Linux pipes and stylish Node-red flows that first caught my interest in NR.

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [20 March 2024 15:35 UTC](https://discourse.nodered.org/t/converting-node-red-flows-to-unix-pipes/86590/5 "2024-03-20T15:35:47Z")

</div>

> [@jbudd](#):
>
> First time I've heard of `yes` (yes, it's `true` 🙃 )

The command `yes no` is wonderful example of Unix versatility 😉

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [20 March 2024 20:18 UTC](https://discourse.nodered.org/t/converting-node-red-flows-to-unix-pipes/86590/6 "2024-03-20T20:18:43Z")

</div>

> [@gregorius](#):
>
> UNIX pipe

I probably should be somewhat annoying here and point out that there is a 2nd type of pipe called a "named pipe" which creates an interprocess communications pipeline and works on Windows as well as UNIX and UNIX-like systems.

These are very cool but woefully under utilised. 🤓

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [18 June 2024 20:19 UTC](https://discourse.nodered.org/t/converting-node-red-flows-to-unix-pipes/86590/7 "2024-06-18T20:19:16Z")

</div>

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