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.

SFTP 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.

InputDefaultNotesExample
Input
Host
string
/ Required
Default
 
Notes
The address of the SFTP server. This should be either an IP address or hostname.
Example
sftp.prismatic.io
Input
Password
password
/ Required
Default
 
Notes
 
Example
p@s$W0Rd
Input
Port
string
/ Required
Default
22
Notes
The port of the SFTP server.
Example
2222
Input
Timeout
string
Default
3000
Notes
How long the client will await a request.
Example
4000
Input
Username
string
/ Required
Default
 
Notes
 
Example
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.

InputDefaultNotesExample
Input
Host
string
/ Required
Default
 
Notes
The address of the SFTP server. This should be either an IP address or hostname.
Example
sftp.prismatic.io
Input
Port
string
/ Required
Default
22
Notes
The port of the SFTP server.
Example
2222
Input
Private Key
text
/ Required
Default
 
Notes
SSH private key
Example
-----BEGIN OPENSSH PRIVATE KEY----- abc123...
Input
Timeout
string
Default
3000
Notes
How long the client will await a request.
Example
4000
Input
Username
string
/ Required
Default
 
Notes
 
Example
john.doe

Actions#

Delete File#

Delete a file from a SFTP server | key: deleteFile

InputNotesExample
Input
Connection
connection
/ Required
Notes
 
Example
 
Input
Path
string
/ Required
Notes
Path of file to delete
Example
/path/to/file.txt

List Directory#

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

InputDefaultNotesExample
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
Path
string
/ Required
Default
 
Notes
Path of directory on an SFTP server to list files of
Example
/path/to/directory/
Input
Pattern
string
Default
*
Notes
Glob-style string for listing specific files
Example
*.txt

Output Example Payload#

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

Move File#

Move a file on an SFTP server | key: moveFile

InputNotesExample
Input
Connection
connection
/ Required
Notes
 
Example
 
Input
Destination Path
string
/ Required
Notes
Path of file to move
Example
/my/destination/path.txt
Input
Source Path
string
/ Required
Notes
Path of file to move
Example
/my/starting/path.txt

Read File#

Read a file from SFTP | key: readFile

InputNotesExample
Input
Connection
connection
/ Required
Notes
 
Example
 
Input
Path
string
/ Required
Notes
Path of file on SFTP server to read data from
Example
/path/to/file.txt

Output Example Payload#

{  "data": {    "type": "Buffer",    "data": [      101,      120,      97,      109,      112,      108,      101    ]  },  "contentType": "application/octet"}

Stat File#

Pull statistics about a file | key: statFile

InputNotesExample
Input
Connection
connection
/ Required
Notes
 
Example
 
Input
Path
string
/ Required
Notes
Path of file on SFTP server to read data from
Example
/path/to/file.txt

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

InputNotesExample
Input
Connection
connection
/ Required
Notes
 
Example
 
Input
Data
text
/ Required
Notes
Text to write into the file
Example
 
Input
Path
string
/ Required
Notes
Path on SFTP server to write file
Example
/we/love/commas.csv