SFTP Component
Read, write, move and delete files on an SFTP server
Component key: sftp
Description
The SFTP (SSH File Transfer Protocol) component lets you upload, download, move and delete files on an SFTP server.
A common integration pattern involves listing files in a file store, and performing a series of actions on the array of files that are returned. See our looping over files quickstart for information about how to create a loop over an array of files.
Connections
Basic Username/Password
The basic auth connection is used to connect to SFTP servers that support username / password login. Consult your SFTP server administrator to determine which login method the server supports.
On-prem enabled: this connection can be configured to connect to an on-prem resource on a private network. Learn more.
| Input | Notes | Example |
|---|---|---|
| Custom Ciphers | A comma-separated list of custom ciphers. Overrides the default ciphers. Cipher order matters. Advanced setting. | aes128-ctr, aes192-ctr, aes256-ctr |
| Custom Server Host Key Algorithms | A comma-separated list of custom server host key algorithms. Overrides the default server host key algorithms. Algorithm order matters. Advanced setting. | ssh-rsa, ssh-dss |
| Enable Unsecure Ciphers | If true, CBC ciphers will be added to the connection. | false |
| Enable Unsecure Server Host Key Algorithms | If true, unsecure server host key algorithms will be added to the connection. | false |
| Host | The address of the SFTP server. This should be either an IP address or hostname. | sftp.example.com |
| Password | Password for SFTP authentication | p@s$W0Rd |
| Port | The port of the SFTP server. | 2222 |
| Timeout | How long the client will await a request. | 4000 |
| Username | john.doe |
Private Key
The private key connection allows you to access an SFTP server via SSH public/private key authentication. You will need to generate a public/private key pair, and ensure that your public key is stored on the SFTP server that you are connecting to. Then, you can authenticate with the SFTP server using a username and corresponding private key.
On-prem enabled: this connection can be configured to connect to an on-prem resource on a private network. Learn more.
| Input | Notes | Example |
|---|---|---|
| Custom Ciphers | A comma-separated list of custom ciphers. Overrides the default ciphers. Cipher order matters. Advanced setting. | aes128-ctr, aes192-ctr, aes256-ctr |
| Custom Server Host Key Algorithms | A comma-separated list of custom server host key algorithms. Overrides the default server host key algorithms. Algorithm order matters. Advanced setting. | ssh-rsa, ssh-dss |
| Enable Unsecure Ciphers | If true, CBC ciphers will be added to the connection. | false |
| Enable Unsecure Server Host Key Algorithms | If true, unsecure server host key algorithms will be added to the connection. | false |
| Host | The address of the SFTP server. This should be either an IP address or hostname. | sftp.example.com |
| Key Passphrase | Passphrase for the private key. Leave blank if none. | p@s$PHr@$3 |
| Password | Though uncommon, some SFTP servers that use private keys may also require a password. Leave blank if none. | p@s$W0Rd |
| Port | The port of the SFTP server. | 2222 |
| Private Key | SSH private key | -----BEGIN OPENSSH PRIVATE KEY----- abc123... |
| Timeout | How long the client will await a request. | 4000 |
| Username | john.doe |
Actions
Append File
Append data to an existing file on a SFTP server. | key: appendFile
| Input | Notes | Example |
|---|---|---|
| Connection | ||
| Data | Text to append to the file. | |
| Path | Path on SFTP server to append file. | /path/to/remote/file.txt |
{
"data": "Appended data to /upload/path/to/file.txt"
}
Create Directory
Create a new directory. If the recursive flag is set to true, the method will create any directories in the path which do not already exist. | key: createDirectory
| Input | Notes | Example |
|---|---|---|
| Connection | ||
| Path | Path of directory on an SFTP server to list files of | /path/to/directory/ |
| Recursive | If true, create any missing directories in the path as well | true |
{
"data": "/path/to/new/directory/"
}
Delete File
Delete a file from a SFTP server | key: deleteFile
| Input | Notes | Example |
|---|---|---|
| Connection | ||
| Path | Path of file to delete | /path/to/file.txt |
Fast Get
Read a file from SFTP | key: fastGet
| Input | Notes | Example |
|---|---|---|
| Connection | ||
| Path | Path of file on SFTP server to read data from | /path/to/file.txt |
| Always Return Buffer | Always treat the file as a binary file with content type 'application/octet-stream', even if it is a text file. This is helpful if you are processing non-UTF-8 text files, as the runner assumes text files are UTF-8. | false |
{
"data": {
"type": "Buffer",
"data": [
83,
97,
109,
112,
108,
101,
32,
102,
105,
108,
101,
32,
99,
111,
110,
116,
101,
110,
116,
115
]
},
"contentType": "text/plain"
}
List Directory
List files and directories in a directory on an SFTP server. Optionally list files in subdirectories. | key: listDirectory
| Input | Notes | Example |
|---|---|---|
| Connection | ||
| Include Directories | If true, will list directories in addition to files. If false, only lists files. | false |
| Include Subdirectories | If true, will list files in all subdirectories. If false, only lists files in the specified directory. | false |
| Path | Path of directory on an SFTP server to list files of | /path/to/directory/ |
| Pattern | Glob-style string for listing specific files | *.txt |
{
"data": [
"folder1/file.txt",
"folder1/subfolder/example.txt",
"root.txt"
]
}
Move File
Move a file on an SFTP server | key: moveFile
| Input | Notes | Example |
|---|---|---|
| Connection | ||
| Destination Path | Path of file to move | /my/destination/path.txt |
| Source Path | Path of file to move | /my/starting/path.txt |
Read File
Read a file from SFTP | key: readFile
| Input | Notes | Example |
|---|---|---|
| Connection | ||
| Path | Path of file on SFTP server to read data from | /path/to/file.txt |
| Always Return Buffer | Always treat the file as a binary file with content type 'application/octet-stream', even if it is a text file. This is helpful if you are processing non-UTF-8 text files, as the runner assumes text files are UTF-8. | false |
{
"data": "Sample file contents",
"contentType": "text/plain"
}
Stat File
Pull statistics about a file | key: statFile
| Input | Notes | Example |
|---|---|---|
| Connection | ||
| Path | Path of file on SFTP server to read data from | /path/to/file.txt |
{
"data": {
"mode": 33279,
"uid": 1000,
"gid": 985,
"size": 5,
"accessTime": 1566868566000,
"modifyTime": 1566868566000,
"isDirectory": false,
"isFile": true,
"isBlockDevice": false,
"isCharacterDevice": false,
"isSymbolicLink": false,
"isFIFO": false,
"isSocket": false
}
}
Write File
Write a file to SFTP | key: writeFile
| Input | Notes | Example |
|---|---|---|
| Connection | ||
| Data | Text to write into the file. | |
| Path | Path to file on SFTP server. | /we/love/commas.csv |
{
"data": "Uploaded data stream to /upload/path/to/file.txt"
}