Skip to main content

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.

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.

Actions

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

Output Example Payload

{
"data": "/path/to/new/directory/"
}

Delete File

Delete a file from a SFTP server | key: deleteFile


List Directory

List files in a directory on an SFTP server | key: listDirectory

Output Example Payload

{
"data": [
"file.txt",
"example.txt"
]
}

Move File

Move a file on an SFTP server | key: moveFile


Read File

Read a file from SFTP | key: readFile

Output Example Payload

{
"data": "Sample file contents",
"contentType": "text/plain"
}

Stat File

Pull statistics about a file | key: statFile

Output Example Payload

{
"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

Output Example Payload

{
"data": "Uploaded data stream to /upload/path/to/file.txt"
}