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
host
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
password
Default
Notes
 
Example
p@s$W0Rd
Input
Port
string
/ Required
port
Default
22
Notes
The port of the SFTP server.
Example
2222
Input
Timeout
string
timeout
Default
3000
Notes
How long the client will await a request.
Example
4000
Input
Username
string
/ Required
username
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
host
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
port
Default
22
Notes
The port of the SFTP server.
Example
2222
Input
Private Key
text
/ Required
privateKey
Default
Notes
SSH private key
Example
-----BEGIN OPENSSH PRIVATE KEY----- abc123...
Input
Timeout
string
timeout
Default
3000
Notes
How long the client will await a request.
Example
4000
Input
Username
string
/ Required
username
Default
Notes
 
Example
john.doe

Actions#

Delete File#

Delete a file from a SFTP server | key: deleteFile

InputDefaultNotesExample
Input
Connection
connection
/ Required
connection
Default
 
Notes
 
Example
 
Input
Show Debug Output
boolean
/ Required
debug
Default
false
Notes
Show additional debug output in logs. Note: SFTP is very verbose - expect hundreds of debug lines when this is enabled.
Example
 
Input
Path
string
/ Required
path
Default
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
connection
Default
 
Notes
 
Example
 
Input
Show Debug Output
boolean
/ Required
debug
Default
false
Notes
Show additional debug output in logs. Note: SFTP is very verbose - expect hundreds of debug lines when this is enabled.
Example
 
Input
Path
string
/ Required
path
Default
Notes
Path of directory on an SFTP server to list files of
Example
/path/to/directory/
Input
Pattern
string
pattern
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

InputDefaultNotesExample
Input
Connection
connection
/ Required
connection
Default
 
Notes
 
Example
 
Input
Show Debug Output
boolean
/ Required
debug
Default
false
Notes
Show additional debug output in logs. Note: SFTP is very verbose - expect hundreds of debug lines when this is enabled.
Example
 
Input
Destination Path
string
/ Required
destinationPath
Default
Notes
Path of file to move
Example
/my/destination/path.txt
Input
Source Path
string
/ Required
sourcePath
Default
Notes
Path of file to move
Example
/my/starting/path.txt

Read File#

Read a file from SFTP | key: readFile

InputDefaultNotesExample
Input
Connection
connection
/ Required
connection
Default
 
Notes
 
Example
 
Input
Show Debug Output
boolean
/ Required
debug
Default
false
Notes
Show additional debug output in logs. Note: SFTP is very verbose - expect hundreds of debug lines when this is enabled.
Example
 
Input
Path
string
/ Required
inputPath
Default
Notes
Path of file on SFTP server to read data from
Example
/path/to/file.txt

Output Example Payload#

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

Stat File#

Pull statistics about a file | key: statFile

InputDefaultNotesExample
Input
Connection
connection
/ Required
connection
Default
 
Notes
 
Example
 
Input
Show Debug Output
boolean
/ Required
debug
Default
false
Notes
Show additional debug output in logs. Note: SFTP is very verbose - expect hundreds of debug lines when this is enabled.
Example
 
Input
Path
string
/ Required
inputPath
Default
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

InputDefaultNotesExample
Input
Connection
connection
/ Required
connection
Default
 
Notes
 
Example
 
Input
Data
text
/ Required
data
Default
Notes
Text to write into the file
Example
 
Input
Show Debug Output
boolean
/ Required
debug
Default
false
Notes
Show additional debug output in logs. Note: SFTP is very verbose - expect hundreds of debug lines when this is enabled.
Example
 
Input
Path
string
/ Required
outputPath
Default
Notes
Path on SFTP server to write file
Example
/we/love/commas.csv

Output Example Payload#

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