Detect File
Detects the MIME type of a file using the mimetype library.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- File Path - The path to the file for which to detect the MIME type.
Output
- MIME Type - The detected MIME type of the file.
How It Works
The Detect File node uses the mimetype library to analyze a file and determine its MIME type. When executed, the node:
- Validates the provided file path input
- Uses the mimetype.DetectFile function to analyze the file
- Returns the detected MIME type as a string
Requirements
- A valid file path to analyze
- The file must be accessible by the application
Error Handling
The node will return specific errors in the following cases:
- Empty or invalid file path
- File not found or inaccessible
- Error during MIME type detection
Usage Notes
- The MIME type detection is based on the file content, not just the file extension
- The node supports a wide range of file formats including documents, images, audio, video, and more
- The detected MIME type follows the standard MIME type format (e.g., "text/plain", "image/jpeg", "application/pdf")