# @cumulus/sftp-client

> A Promise-based SFTP client

Latest version **22.4.0** (published 2026-09-02) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @cumulus/sftp-client
pnpm add @cumulus/sftp-client
yarn add @cumulus/sftp-client
bun add @cumulus/sftp-client
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 22.4.0 |
| Published | 2026-09-02 |
| First published | 2020-02-06 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 304 |
| Author | Cumulus Authors |
| Maintainers | cumuluspublisher, nsidc_kovarik, jennyhliu, npauzenga, ppilone84, etcart |
| Keywords | GIBS, CUMULUS, NASA |

## Links

- npm: https://www.npmjs.com/package/@cumulus/sftp-client
- Repository: https://github.com/nasa/cumulus
- Homepage: https://github.com/nasa/cumulus/tree/master/packages/sftp-client#readme
- Issues: https://github.com/nasa/cumulus/issues
- npm.io page: https://npm.io/package/@cumulus/sftp-client

## Recent versions

- 22.4.0 (latest) — 2026-09-02
- 21.3.5 (release-v21.3.5) — 2026-06-03
- 20.3.3 (release-v20.3.3) — 2026-04-16
- 21.2.1 (release-v21.2.1) — 2026-03-18
- 21.3.2-testlerna.0 (release-v21.3.2-testlerna.0) — 2026-03-02
- 21.3.1-alpha.0 (release-v21.3.1-alpha.0) — 2026-01-28
- 20.3.2 (release-v20.3.2) — 2025-12-04
- 20.2.3 (release-v20.2.3) — 2025-12-03
- 21.0.0-echo10 (release-v21.0.0-echo10) — 2025-11-21
- 20.3.1 (release-v20.3.1) — 2025-10-14
- 20.2.2 (release-v20.2.2) — 2025-10-08
- 20.1.3-alpha.2 (release-v20.1.3-alpha.2) — 2025-05-15
- 20.1.3-alpha.1 (release-v20.1.3-alpha.1) — 2025-05-15
- 20.1.3-alpha.0 (release-v20.1.3-alpha.0) — 2025-05-14
- 18.5.6 (release-v18.5.6) — 2025-04-11
- … 163 more at https://npm.io/package/@cumulus/sftp-client/versions

## README

# @cumulus/sftp-client

> A Promise-based SFTP client

## Install

```shell
npm install @cumulus/sftp-client
```

## Usage

```js
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`<br>
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 `object`s containing information about discovered files.

The returned file `object`s 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

---
_Source: https://npm.io/package/@cumulus/sftp-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
