Skip to content

qie.readFTPFileNoEncryption

Signature: qie.readFTPFileNoEncryption(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

try {
    qie.writeFTPFileNoEncryption(
        'sftp.example.com', // host
        21,                 // port
        'theirs.txt',       // path
        false,              // binary
        true,               // passive
        '',                 // ftpParameters
        'interfaceUser',    // userName
        'yourPassword',     // password
        'More data this time to go in their.txt file.'
    );
} catch (error) {
    qie.warn(error); // useful if file already exists
}

var xmlResponse = qie.readFTPFileNoEncryption(
    'sftp.example.com', // host
    21,                 // port
    'theirs.txt',       // path
    true,               // deleteFile
    '/archivePath/',    // archivePath
    false,              // binary
    true,               // passive
    '',                 // ftpParameters
    'interfaceUser',    // userName
    'yourPassword',     // password
    5000                // timeout
);

var base64DecodedXmlValue =
    qie.base64Decode(xmlResponse.getNode('/ftpFile/encodedBytes'));