Socket
Book a DemoInstallSign in
Socket

@cumulus/sftp-client

Package Overview
Dependencies
Maintainers
6
Versions
143
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cumulus/sftp-client

A Promise-based SFTP client

20.3.0
latest
Source
npmnpm
Version published
Maintainers
6
Created
Source

@cumulus/sftp-client

A Promise-based SFTP client

Install

npm install @cumulus/sftp-client

Usage

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("./"));
})();

API

constructor(config)

config

Type: object

config.host

Type: string

The hostname or IP address of the remote SFTP server.

config.port

Type: number
Default: 22

The TCP port to connect to.

config.username

Type: string

The username to use when connecting to the SFTP server.

config.password

Type: string

The password to use when connecting to the SFTP server.

config.privateKey

Type: string

A private key to use when connecting to the SFTP server.

sftpClient.download(remotePath, localPath)

Download a remote file to disk. Returns a Promise that resolves to a string containing the local path that the file was saved to.

remotePath

Type: string

The full path to the remote file to be fetched

localPath

Type: string

The full local destination file path

sftpClient.end()

Close the connect to the SFTP server.

sftpClient.list(remotePath)

Returns a Promise that resolves to an array of objects containing information about discovered files.

The returned file objects will each contain name, path, type, size, and time fields.

remotePath

Type: string

The remote path to be listed.

sftpClient.sftp()

Returns the ssh2-sftp-client Client as a convenience.

sftpClient.syncFromS3(s3Object, remotePath)

Returns a Promise that resolves to undefined once a file has been transferred from S3 to the SFTP server.

s3Object

Type: object

s3Object.Bucket

Type: string

The bucket containing the S3 object to be transferred to the SFTP server.

s3Object.Key

Type: string

The key of the S3 object to be transferred to the SFTP server.

remotePath

Type: string

The full remote destination file path.

sftpClient.syncToS3(remotePath, bucket, key)

Returns a Promise that resolves to a string containing the S3 URI of the destination file

remotePath

Type: string

The full path to the remote file to be fetched

bucket

Type: string

Destination S3 bucket of the file

key

Type: string

Destination S3 key of the file

sftpClient.unlink(remotePath)

Returns a Promise that resolves to undefined once the remote file has been deleted.

remotePath

Type: string

The path to file on the SFTP server to be deleted

Keywords

GIBS

FAQs

Package last updated on 20 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.