Get media-type of filename

by Ricardo Fernández Serrata

Version 2 (May 18, 2021)

Download (47 downloads)

An extended and updated version of mimeType function.

"Alternative" is used when you want different output (if available). Example: the 1st (index 0) alt of "js" is "application/javascript" and the 2nd (alt = 1) is "text/javascript". If index is out of bounds, it will return the last alt.

It creates a dictionary that maps extensions to their corresponding types, by downloading CSV files from the official IANA registry. Once the dictionary becomes cached by Atomic Store, the flow returns output faster and more reliably since it avoids internet use.

If you found a file-extension that shouldn't map to "application/octet-stream", please let me know.

Some variables are shared across several blocks to reduce memory usage and block-count.

This is not intended to be directly used by a human, it should be used by a flow for automatic MIME recognition

4.0 average rating from 1 reviews

5 stars
4 stars
3 stars
2 stars
1 star

Rate and review within the app in the Community section.