18.2.1 • Published 1 day ago

@cumulus/sftp-client v18.2.1

Weekly downloads
220
License
Apache-2.0
Repository
github
Last release
1 day ago

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

16.1.5

1 day ago

18.2.1

2 days ago

16.1.4

12 days ago

18.2.0

3 months ago

16.1.3

4 months ago

18.2.0-alpha.0

5 months ago

16.1.1

9 months ago

16.1.0

9 months ago

16.1.2

6 months ago

18.1.0

7 months ago

17.0.0

9 months ago

18.0.0

9 months ago

16.0.3-alpha.0

10 months ago

16.0.0

10 months ago

15.0.4

11 months ago

16.0.1-alpha.0

11 months ago

16.0.2-alpha.0

11 months ago

15.0.2

1 year ago

15.0.3

1 year ago

15.0.1

1 year ago

14.1.0

1 year ago

15.0.0

1 year ago

13.3.3-alpha.0

2 years ago

13.4.0

2 years ago

14.0.0

1 year ago

13.3.3-alpha.1

2 years ago

11.1.8

2 years ago

13.3.2

2 years ago

12.0.3

2 years ago

13.3.1

2 years ago

11.1.6

2 years ago

11.1.7

2 years ago

13.3.0

2 years ago

13.1.0

2 years ago

12.0.1

2 years ago

12.0.2

2 years ago

10.1.3

2 years ago

13.2.0

2 years ago

13.2.1

2 years ago

13.0.0

2 years ago

13.0.1

2 years ago

11.1.5

2 years ago

11.1.3

2 years ago

11.1.4

2 years ago

11.1.2

2 years ago

12.0.0

2 years ago

10.0.2

2 years ago

11.1.1

2 years ago

11.1.0

2 years ago

11.0.0

2 years ago

9.9.4

2 years ago

10.1.2

2 years ago

9.4.2

2 years ago

10.1.1

2 years ago

9.4.1

2 years ago

10.0.0

2 years ago

10.0.1

2 years ago

9.9.1

2 years ago

9.7.1

2 years ago

10.1.0

2 years ago

9.9.2

2 years ago

9.9.3

2 years ago

9.2.4

2 years ago

9.2.3

2 years ago

10.0.0-beta.0

2 years ago

9.9.0

3 years ago

9.8.0

3 years ago

9.7.0

3 years ago

9.6.0

3 years ago

9.6.0-alpha.1

3 years ago

9.5.0

3 years ago

9.4.0

3 years ago

9.2.2

3 years ago

8.1.2

3 years ago

9.2.1

3 years ago

9.3.0

3 years ago

9.2.0

3 years ago

8.1.1

3 years ago

9.1.0

3 years ago

8.1.0

3 years ago

9.0.1

3 years ago

9.0.0

3 years ago

8.0.0

3 years ago

6.0.1

3 years ago

7.2.0

3 years ago

7.1.0

3 years ago

7.0.0

3 years ago

6.0.0

3 years ago

5.0.1

3 years ago

5.0.0

3 years ago

4.0.0

3 years ago

3.0.1

4 years ago

2.0.8

4 years ago

3.0.0

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.24.0

4 years ago

1.23.2

4 years ago

1.23.1

4 years ago

1.23.0

4 years ago

1.22.1

4 years ago

1.22.0

4 years ago

1.21.0

4 years ago

1.20.0

4 years ago

1.19.0

4 years ago

1.18.0-alpha.1

4 years ago

1.18.0-alpha.0

4 years ago