Download
Downloads a file from an FTP server to the local machine.
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 ContinueOnError property is true, no error is caught when the project is executed even if Catch node is used.
Input
- Session Id - The Session ID that was created during the FTP login process. The ID is the output of the Connect node.
- FTP File Path - Path of the file to download on the FTP server.
- Local File Path - Path where the downloaded file will be saved on the local machine.
How It Works
The Download node retrieves a file from the remote FTP server to the local machine:
- Session Validation: Verifies the session ID is valid and active
- Path Validation: Ensures both FTP and local paths are provided
- File Existence Check: Verifies the file exists on the FTP server
- File Download: Reads the file from the server
- Local Storage: Writes the file to the specified local path
Requirements
- Active FTP session from the Connect node
- Valid file path on the FTP server
- Read permissions on the remote file
- Write permissions on the local directory
- Sufficient disk space on the local machine
- Local directory must exist (file will be created automatically)
Error Handling
| Error Code | Description | Cause |
|---|---|---|
| Core.FTP.Download.ErrOnCreate | Config parse error | Node configuration is malformed |
| Core.FTP.Download.OnMessage | Message parse error | Input message cannot be parsed |
| Core.FTP.Download.ErrSession | Session id can not be empty | Session ID input is empty |
| Core.FTP.Download.ErrSession | Invalid session | Session ID does not exist or has expired |
| Core.FTP.Download.ErrFTPPath | FTP path could not be empty | FTP file path input is empty |
| Core.FTP.Download.ErrLocalPath | Local path could not be empty | Local file path input is empty |
| Core.FTP.Download.Error | Download error | File download failed (details in error message) |
Usage Examples
Example 1: Download a Single File
// Input:
// Session ID: "ftp-session-123"
// FTP File Path: "/reports/sales-2024.pdf"
// Local File Path: "C:/Downloads/sales-2024.pdf"
//
// Downloads the file from server to local machine
Example 2: Download with Dynamic File Names
// Using variables for flexible downloads
// Session ID: "ftp-session-123"
// FTP File Path: "/daily-reports/" + msg.date + ".csv"
// Local File Path: "C:/Reports/" + msg.date + ".csv"
//
// Allows downloading files based on workflow data
Example 3: Batch Download in Loop
// Workflow:
// 1. List files in "/incoming" directory
// 2. For each file in list:
// - Download file to "C:/Processing/"
// - Process the file
// - Delete from FTP server
//
// Use ForEach to iterate over file list
Usage Notes
- If the local file already exists, it will be overwritten without warning
- The local directory path must exist; the node doesn't create parent directories
- Use absolute paths for both FTP and local file paths
- File permissions are set to 0644 (rw-r--r--) on the local file
- Large files are downloaded in memory, ensure sufficient RAM
- Use forward slashes (/) in FTP paths, backslashes () in Windows local paths
- Network interruptions will cause the download to fail completely
Tips
- Check if the file exists using File Exists node before downloading
- Use unique local file names to avoid overwriting important files
- Implement error handling for network failures during large downloads
- Monitor disk space before downloading large files
- Create local directories before download using File System nodes
- Log successful downloads for audit trails
- Consider download timeouts for very large files
- Use temporary directories for downloads, then move files after validation
- Verify file integrity after download (size, checksum) for critical files
Related Nodes
- Connect - Establish FTP connection
- Upload - Upload files to FTP server
- File Exists - Check if file exists before download
- List Directory - Find files to download
- Delete File - Delete file after download
- Move File - Move file after download
- Disconnect - Close the FTP session