Overview
This node enables interaction with FTP, FTPS (FTP over TLS), and SFTP servers to perform common file operations. It supports listing files and folders, downloading files, uploading files, deleting files or directories, and renaming files or directories on remote servers.
Typical use cases include:
- Automating file management tasks on remote servers.
- Integrating legacy systems that expose data via FTP/SFTP.
- Periodically syncing files between local and remote locations.
- Processing files retrieved from an FTP server in subsequent workflow steps.
For example, you can list all files in a directory recursively, download specific files for processing, upload generated reports, or clean up old files by deleting them.
Properties
| Name | Meaning |
|---|---|
| Path | The remote path on the FTP/SFTP server where the operation will be performed. |
| Recursive | Whether to perform the operation recursively (applicable for "list" and "delete" only). |
Output
The output is a JSON object whose structure depends on the selected operation:
List: Returns an object with a
filesarray containing entries with:name: File or directory name.size: Size in bytes.type: Either"file"or"directory".modifiedAt: Timestamp of last modification.
Download: Returns a binary property (name configurable) containing:
data: Base64-encoded file content.mimeType: Always"application/octet-stream".fileName: The base name of the downloaded file.
Upload: Returns a success message indicating the file was uploaded.
Delete: Returns a success message indicating the file or directory was deleted.
Rename: Returns a success message indicating the file or directory was renamed.
If an error occurs during any operation, the output JSON contains an error field with the error message.
Dependencies
- Requires credentials for connecting to FTP/FTPS/SFTP servers, including host, port, username, password/private key, and optional TLS settings.
- Uses the following npm packages internally:
basic-ftpfor FTP and FTPS connections.ssh2-sftp-clientfor SFTP connections.
- No additional environment variables are required beyond the provided credentials.
Troubleshooting
- Connection failures: Ensure correct host, port, and authentication details. For FTPS, verify TLS version compatibility.
- Permission errors: Check user permissions on the remote server for the requested operation.
- Recursive operations: Recursive delete or list may fail if the server does not support recursive commands or if permissions are insufficient.
- File not found: Verify the specified path exists on the remote server.
- Unknown operation error: Occurs if an unsupported operation value is passed; ensure the operation parameter is one of the supported options.
Common error messages include:
"FTP operation failed: ..."or"SFTP operation failed: ..."indicating issues during communication or command execution."Unknown operation: ..."indicating an invalid operation parameter.
Resolving these typically involves verifying credentials, paths, and server capabilities.