[IF] How to sort by binary data MIME type?

,

Describe the issue/error/question

First off i wanna say what a great job you guys are doing with the new updates, im loving the new layout and all the improvements happening. on a side note, since the previous 2 updates its felt like the whole thing loads much slower than usual 3x to 4x slower to load up workflows.

Seems like quite a simple thing, but I would like to sort items using the if node based on their mime types see screenshot below


I will mainly be dealing with mime types

  • Application/Pdf
  • Plain/Text
    Ive got a function for reading byte size from binary data before from Mutedjam
    I guess its something similar to that like replacing binaryContent.length with something else like mimetype.

In the json data there is nothing about mime types

What is the error message (if any)?

Please share the workflow

Share the output returned by the last node

Information on your n8n setup

  • latest N8n running in docker container

Hi @Josh-Ghazi, you should be able to use the MIME type in a IF node without additional nodes. Simply open the expression editor in your IF node by clicking the respective button:

image

Then simply pick the MIME type property of the incoming item in the tree structure on the left:

Lastly, enter the MIME type you want to compare it against in the Value 2 field of your IF node:

Let me know if you run into any trouble with this.

1 Like

Dear @MutedJam

Thanks for the suggestion, just tried it out just now and it works quite flawlessly, previous to this i was depending on filesize to check binary files, but now with this the entire workflow is far more accurate.

Very happy about learning this, although i should have just check in the parameters instead of assuming it was data that is not easily accessible!

Kindest regards
Josh

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