File type from name
FreeLogic@rabbinatix/file-type-from-name by Rabbinatixupdated Oct 4, 2026
Tells an image, a document or a spreadsheet from the file name.
Takes the text after the last dot (split, reverse, first item) and picks a kind with Switch, one Return per case. Unknown extensions are other.
Shows: Switch with cases and Default, Reverse, Get Item.
How to use it
Add it to your logic, then add a Call Function step in any logic and pick File type. It belongs to no system, so every system can use it. Or download the TypeScript and call it from your own code.
Inputs
fileName: Text
Outputs
kind: Text
extension: Text
Previewdrag the steps around; scroll to zoom
Function Entry, Input / output. 0 inputs, 2 outputs. step 1 of 11
File type
fileName
To Lower Case, String. 1 input, 1 output. step 2 of 11
To Lower Case
text
result
Split, String. 2 inputs, 1 output. step 3 of 11
Split
text
separator
parts
Reverse, Collection. 1 input, 1 output. step 4 of 11
Reverse
array
result
Get Item, Collection. 2 inputs, 1 output. step 5 of 11
Get Item
array
index
item
Switch, Flow control. 2 inputs, 5 outputs. step 6 of 11
Switch
value
jpg
png
pdf
csv
Default
Return, Input / output. 3 inputs, 0 outputs. step 7 of 11
Return
kind
extension
Return, Input / output. 3 inputs, 0 outputs. step 8 of 11
Return
kind
extension
Return, Input / output. 3 inputs, 0 outputs. step 9 of 11
Return
kind
extension
Return, Input / output. 3 inputs, 0 outputs. step 10 of 11
Return
kind
extension
Return, Input / output. 3 inputs, 0 outputs. step 11 of 11
Return
kind
extension
Arrow keys: next or previous step in flow order. Alt with arrows: nearest step in that direction. Enter: open. Shift F10: more actions.
Examplesrun live against the logic · 3/3 pass
| Passed | Example | Input | Output |
|---|---|---|---|
| A photo | {"fileName":"Holiday.JPG"} | {"kind":"image","extension":"jpg"} | |
| A report | {"fileName":"q3.report.pdf"} | {"kind":"document","extension":"pdf"} | |
| Unknown | {"fileName":"notes.txt"} | {"kind":"other","extension":"txt"} |
Try it
Versions
In this package
File type (entry)
