Determine Mime Type for File Extension

Recipe Tools

What it does

When someone calls this function with a file extension, the automation returns the matching mime type. The result is available immediately for downstream use in other steps.

Who it's for

Engineering and Data and analytics teams who need to identify file mime types programmatically.

How teams use this

Validate uploaded files by type

Call this function when a file is uploaded to determine its mime type and reject it if it does not match allowed types. Validation happens in real time before processing.

Set correct headers in API responses

Use the returned mime type to set the content-type header when serving files through an API. This ensures browsers and clients handle the file correctly based on its type.

Route files to storage by type

Call this function to determine the mime type, then route the file to different storage systems based on the result. Only certain types go to each destination.

How it works

  1. Receive the file extension input. A function call in Workato Recipe Function passes a file extension as input to start this automation.
  2. Return the matching mime type. Workato Recipe Function returns the mime type that corresponds to the file extension so downstream steps can reference it.