qie.readFTPFileImplicitTLS¶
Signature: qie.readFTPFileImplicitTLS(host, port, path, deleteFile, archivePath, binary, passive, ftpParameters, userName, password, timeout)
Returns: XML Message fileContentXml - an XML message containing the base64 encoded content of the file and the meta-data
Reads one file from the specified path.
Note
QIE uses version 4.22.0 of Apache Camel. (See this article for available parameters).
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String | host | hostname or ip address for the ftp server | |
| Integer | port | the port number to use | |
| String | path | file path to read file from | |
| Boolean | deleteFile | if 'deleteFile' is true and 'archivePath' is null or blank, then the file will be deleted after it is downloaded | |
| String | archivePath | move file to 'archivePath' once it has been read. Leave this blank or null to use the 'deleteFile' option. | |
| Boolean | binary | transfer data using binary protocol | |
| Boolean | passive | use passive transfer mode (usually true) | |
| String | ftpParameters | additional custom camel ftp parameters to be used by this connection. (Format: {key}={value}\n{key2}={value2}...) | |
| String | userName | username to use for this connection | |
| String | password | password to use for this connection | |
| Integer | timeout | time in milliseconds to wait for connection before error |
Example¶
// Example: read a file from an FTP endpoint using Implicit TLS.
// First write a file so there is something to read (ignore errors if it already exists).
try {
qie.writeFTPFileImplicitTLS(
'sftp.example.com', // host
990, // port (FTP Implicit TLS default)
'bob.txt', // path
false, // binary
true, // passive
'', // ftp parameters
'interfaceUser', // username
'yourPassword', // password
'Some data to go in bob.txt.' // data
);
} catch (error) {
qie.warn(error);
}
var xmlResponse = qie.readFTPFileImplicitTLS(
'sftp.example.com', // host
990, // port (FTP Implicit TLS default)
'bob.txt', // path
true, // deleteFile
'/archivePath/', // archivePath (leave blank/null to use deleteFile)
false, // binary
true, // passive
'', // ftp parameters
'interfaceUser', // username
'yourPassword', // password
5000 // timeout (ms)
);
// Extract and decode the file contents from the XML response
var encodedBytes = xmlResponse.getNode('/ftpFile/encodedBytes');
var fileContents = qie.base64Decode(encodedBytes);