A Promise-based SFTP client
npm install @cumulus/sftp-client
const { SftpClient } = require("@cumulus/sftp-client");
(async () => {
const sftpClient = new SftpClient({
host: "ssh.example.com",
port: 2222,
username: "my-username",
password: "my-password"
});
console.log(await sftpClient.list("./"));
})();
Type: object
Type: string
The hostname or IP address of the remote SFTP server.
Type: number
Default: 22
The TCP port to connect to.
Type: string
The username to use when connecting to the SFTP server.
Type: string
The password to use when connecting to the SFTP server.
Type: string
A private key to use when connecting to the SFTP server.
Download a remote file to disk. Returns a Promise
that resolves to a string
containing the local path that the file was saved to.
Type: string
The full path to the remote file to be fetched
Type: string
The full local destination file path
Close the connect to the SFTP server.
Returns a Promise
that resolves to an array
of object
s containing information about discovered files.
The returned file object
s will each contain name
, path
, type
, size
, and time
fields.
Type: string
The remote path to be listed.
Returns the ssh2-sftp-client
Client as a convenience.
Returns a Promise
that resolves to undefined
once a file has been transferred from S3 to the SFTP server.
Type: object
Type: string
The bucket containing the S3 object to be transferred to the SFTP server.
Type: string
The key of the S3 object to be transferred to the SFTP server.
Type: string
The full remote destination file path.
Returns a Promise
that resolves to a string
containing the S3 URI of the destination file
Type: string
The full path to the remote file to be fetched
Type: string
Destination S3 bucket of the file
Type: string
Destination S3 key of the file
Returns a Promise
that resolves to undefined
once the remote file has been deleted.
Type: string
The path to file on the SFTP server to be deleted