Module - File Transfer Protocol (FTP)
Collection of functions for File Transfer Protocol (FTP)
Activities
Get access to FTP.
| Technical Name |
Type |
Minimal Agent Version |
| access |
asynchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Input Parameters:
| Name |
Type |
Attributes |
Default |
Description |
| host |
string |
mandatory
|
|
URL of the host. |
| user |
string |
mandatory
|
|
Name of the account. |
| password |
string |
mandatory
|
|
Password. |
| port |
number |
optional
|
|
Port implicit value is 21 for FTP and FTPS, and 22 for SFTP. |
| type |
irpa_core.enums.typeFtp |
optional
|
sftp |
Enumeration to define the type of FTP. The default type is SFTP (SSH File Transfer Protocol). |
| rejectUnauthorized |
boolean |
optional
|
true |
Reject unauthorized. The default value is true. |
Sample Code:
await irpa_core.ftp.access("test.rebex.net","demo", "password", 21, irpa_core.enums.typeFtp.ftp);
Upload a file using FTP.
| Technical Name |
Type |
Minimal Agent Version |
| uploadFrom |
asynchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Input Parameters:
| Name |
Type |
Attributes |
Default |
Description |
| localPath |
string |
mandatory
|
|
Full path of the local file. |
| remotePath |
string |
mandatory
|
|
Full path of the remote file. |
Sample Code:
await irpa_core.ftp.uploadFrom("readme.txt","//pub//example//readme.txt")
Download a file using FTP.
| Technical Name |
Type |
Minimal Agent Version |
| downloadTo |
asynchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Input Parameters:
| Name |
Type |
Attributes |
Default |
Description |
| localPath |
string |
mandatory
|
|
Full path of the local file. |
| remotePath |
string |
mandatory
|
|
Full path of the remote file. |
Sample Code:
await irpa_core.ftp.downloadTo("readme.txt","//pub//example//readme.txt")
| Get File Collection (FTP) |
Retrieve the list (collection) of files within a remote path for a specific remote FTP server. By default, the current directory will be used if no remote path is provided. Requires a valid FTP session and browse rights.
| Technical Name |
Type |
Minimal Agent Version |
| getFileCollection |
asynchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Input Parameters:
| Name |
Type |
Attributes |
Default |
Description |
| remotePath |
string |
optional
|
|
The remote path location of the FTP server. |
Output Parameters:
| Name |
Type |
Description |
| ftpFileCollection |
Array. |
A list of files currently within a remote FTP folder. |
Sample Code:
const fileCollection = await irpa_core.ftp.getFileCollection('./dir/folder1');
| Get Folder Collection (FTP) |
Retrieve the list (collection) of folders within a remote path for a given remote FTP server. By default, the current directory will be used if no remote path is provided. Requires a valid FTP session and browse rights.
| Technical Name |
Type |
Minimal Agent Version |
| getFolderCollection |
asynchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Input Parameters:
| Name |
Type |
Attributes |
Default |
Description |
| remotePath |
string |
optional
|
|
The remote path location of the FTP server. |
Output Parameters:
| Name |
Type |
Description |
| ftpFolderCollection |
Array. |
A list of folders currently within a remote FTP folder. |
Sample Code:
const folderCollection = await irpa_core.ftp.getFolderCollection('./dir/folder1');
| Get Content Information (FTP) |
Retrieve some information such as the size, kind, or rights for a given remote FTP path. You cannot get the rights if you use a Windows FTP server.
| Technical Name |
Type |
Minimal Agent Version |
| getContentInformation |
asynchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Input Parameters:
| Name |
Type |
Attributes |
Default |
Description |
| remotePath |
string |
optional
|
|
The remote path location of the FTP server. |
Output Parameters:
Sample Code:
const ftpContentInfo = await irpa_core.ftp.getContentInformation('./dir/folder1');
Sample Code:
const ftpContentInfo = await irpa_core.ftp.getContentInformation('./dir/folder1/text1.txt');
Create a folder within a remote FTP server. By default, the current directory will be used if no remote path is provided. Requires a valid FTP session and write access.
| Technical Name |
Type |
Minimal Agent Version |
| createFolder |
asynchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Input Parameters:
| Name |
Type |
Attributes |
Default |
Description |
| folderName |
string |
mandatory
|
|
Name of the folder. It might be required to check whether some rules apply on the remote location. |
| remotePath |
string |
optional
|
|
The remote path location of the FTP server. |
| ifExists |
boolean |
optional
|
true |
Throws an error if the remote folder already exists. Set the parameter to 'false' to skip the verification. |
Sample Code:
await irpa_core.ftp.createFolder('./dir/folder1');
Errors:
| Error Class |
Package |
Description |
| Error |
irpa_core |
Throw an error if the remote folder already exists. False will skip. |
Delete a folder from a remote FTP server. Requires the remote path, an empty folder, a valid FTP session, and write access.
| Technical Name |
Type |
Minimal Agent Version |
| deleteFolder |
asynchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Input Parameters:
| Name |
Type |
Attributes |
Default |
Description |
| folderName |
string |
mandatory
|
|
Folder to remove from the remote FTP server. |
| remotePath |
string |
mandatory
|
|
The remote path location of the FTP server. |
Sample Code:
await irpa_core.ftp.deleteFolder('./dir/folder1');
Errors:
| Error Class |
Package |
Description |
| Error |
irpa_core |
Cannot remove the directory due to not empty folder. |
Delete a file from a remote FTP server. Requires the remote path, a valid FTP session, and write access.
| Technical Name |
Type |
Minimal Agent Version |
| deleteFile |
asynchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Input Parameters:
| Name |
Type |
Attributes |
Default |
Description |
| fileName |
string |
mandatory
|
|
File to remove from the remote FTP server. |
| remotePath |
string |
mandatory
|
|
The remote path location of the FTP server. |
Sample Code:
await irpa_core.ftp.deleteFile('./dir/folder1/text1.txt');
Rename a folder or a file within a remote FTP server. Requires the remote path, a valid FTP session, and write access.
| Technical Name |
Type |
Minimal Agent Version |
| rename |
asynchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Input Parameters:
| Name |
Type |
Attributes |
Default |
Description |
| oldName |
string |
mandatory
|
|
Current name of the folder or file. |
| newName |
string |
mandatory
|
|
New name of the folder or file. |
| remotePath |
string |
mandatory
|
|
The remote path location of the FTP server. |
Sample Code:
await irpa_core.ftp.rename('./dir/folder1/text1.txt', './dir/folder1/text2.txt');
Download a folder using FTP.
| Technical Name |
Type |
Minimal Agent Version |
| downloadFolderTo |
asynchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Input Parameters:
| Name |
Type |
Attributes |
Default |
Description |
| localFolderPath |
string |
mandatory
|
|
Full path of the local folder. |
| remoteFolderPath |
string |
mandatory
|
|
Full path of the remote folder. |
Sample Code:
await irpa_core.ftp.downloadFolderTo("//folder//f1","//pub//example//")
Upload a folder using FTP.
| Technical Name |
Type |
Minimal Agent Version |
| uploadFolderFrom |
asynchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Input Parameters:
| Name |
Type |
Attributes |
Default |
Description |
| localFolderPath |
string |
mandatory
|
|
Full path of the local folder. |
| remoteFolderPath |
string |
mandatory
|
|
Full path of the remote folder. |
Sample Code:
await irpa_core.ftp.uploadFolderFrom("//folder//f1","//pub//example//")
| Get Current Directory (FTP) |
Retrieve the current directory using FTP.
| Technical Name |
Type |
Minimal Agent Version |
| getCurrentDirectory |
asynchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Output Parameters:
| Name |
Type |
Description |
| currentDirectory |
string |
The current directory. |
Sample Code:
await irpa_core.ftp.getCurrentDirectory()
| Set Current Directory (FTP) |
Set the current directory using FTP. You cannot use this activity for SFTP protocols.
| Technical Name |
Type |
Minimal Agent Version |
| setCurrentDirectory |
asynchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Input Parameters:
| Name |
Type |
Attributes |
Default |
Description |
| remotePath |
string |
mandatory
|
|
The remote path location of the FTP server. |
Sample Code:
await irpa_core.ftp.setCurrentDirectory('currentDirectory')
Errors:
| Error Class |
Package |
Description |
| NotSupported |
irpa_core |
The set current directory is not supported with the sftp protocol. |
Close an FTP session.
| Technical Name |
Type |
Minimal Agent Version |
| close |
synchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Sample Code:
irpa_core.ftp.close();