Note: when this class is used with sensitive data, be careful in persisting sensitive information to disk.
An example usage is as follows:
var ftp : FTPClient = new dw.net.FTPClient();
ftp.connect("my.ftp-server.com", "username", "password");
var data : String = ftp.get("simple.txt");
ftp.disconnect();
The default connection timeout depends on the script context timeout and will be set to a maximum of 30 seconds (default script context timeout is 10 seconds within storefront requests and 15 minutes within jobs).
IMPORTANT NOTE: Before you can make an outbound FTP connection, the FTP server IP address must be enabled for outbound traffic at the Commerce Cloud Digital firewall for your POD. Please file a support request to request a new firewall rule.
get()
returning a File is 5MBget()
methods returning a file will always try to return MAX_GET_FILE_SIZE bytes instead.
get()
returning a String is 2MBget()
methods returning a String will always try to return MAX_GET_STRING_SIZE bytes instead.
get()
returning a File is forty times the default size for getting a file. The
largest file allowed is 200MB.get()
returning a String is five times the default size for getting a String.
The largest String allowed is 10MB.The maximum and default timeout depend on the script context timeout. The maximum timeout is set to a maximum of 2 minutes. The default timeout for a new client is set to a maximum of 30 seconds.
This method can be called at any time, and will affect the next connection made with this client. It is not possible to set the timeout for an open connection.