# Sort buffer message by extension

**URL:** <https://discourse.nodered.org/t/sort-buffer-message-by-extension/37254>\
**Category:** General\
**Created:** [9 December 2020 15:09 UTC](https://discourse.nodered.org/t/sort-buffer-message-by-extension/37254 "2020-12-09T15:09:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![radmin](https://avatars.discourse-cdn.com/v4/letter/r/919ad9/32.png) [@radmin](https://discourse.nodered.org/u/radmin)\
**Post date:** [9 December 2020 15:09 UTC](https://discourse.nodered.org/t/sort-buffer-message-by-extension/37254/1 "2020-12-09T15:09:02Z")

</div>

Hi, i'm newbe in node red and i've question about buffer parser.  
I'm use node-red-contrib-ftp for get motion alerts from NVR.  
I'm get two messages with picture and video from msg.payload : buffer Can you please advice how can i sort this messages to two output by file extension.  
Thanks in advance.  
 ![buffer](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/d/6d5512be26c66112e0b73704a637fe2e1caa45da.jpeg)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 December 2020 15:13 UTC](https://discourse.nodered.org/t/sort-buffer-message-by-extension/37254/2 "2020-12-09T15:13:24Z")

</div>

Hi & welcome to the forum.

> [@radmin](#):
>
> I'm get two messages with picture and video from msg.payload : buffer Can you please advice how can i sort this messages to two output by file extension

this is quite a basic node-red thing - and as you have already said, you are new to node-red. I will give you a hint below but first, I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

So the red part of the debug message is the `topic` & as you can see it ends with `.h264` or `.jpg` - use a `switch` node to determine which msg is which.

PS, buffer parser is more for converting a buffer or array of values (e.g. from a sensor or PLC or modbus device into usable number/string types - not for image buffers (it can but you dont really want this here))

---

<div class="post-metadata">

**Author:** ![radmin](https://avatars.discourse-cdn.com/v4/letter/r/919ad9/32.png) [@radmin](https://discourse.nodered.org/u/radmin)\
**Post date:** [9 December 2020 16:52 UTC](https://discourse.nodered.org/t/sort-buffer-message-by-extension/37254/3 "2020-12-09T16:52:10Z")

</div>

Thank you Steve.  
You guide about [Understanding and Using The Node-Red Message Object](http://www.steves-internet-guide.com/node-red-message-object/) was helpful for me.

---

<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:** [23 December 2020 16:52 UTC](https://discourse.nodered.org/t/sort-buffer-message-by-extension/37254/4 "2020-12-23T16:52:14Z")

</div>

Closed on 23 December 2020 16:52 UTC

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