19.1.0 • Published 7 months ago

@cumulus/sftp-client v19.1.0

Weekly downloads
220
License
Apache-2.0
Repository
github
Last release
7 months 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.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

18.5.1

7 months ago

19.1.0

7 months ago

18.5.0

8 months ago

18.3.5

8 months ago

19.0.0

9 months ago

18.3.4

9 months ago

18.2.2

12 months ago

18.4.0

9 months ago

18.3.3

9 months ago

18.3.2

10 months ago

18.3.1

11 months ago

18.3.0

11 months ago

16.1.5

1 year ago

18.2.1

1 year ago

16.1.4

1 year ago

18.2.0

1 year ago

16.1.3

1 year ago

18.2.0-alpha.0

1 year ago

16.1.1

2 years ago

16.1.0

2 years ago

16.1.2

2 years ago

18.1.0

2 years ago

17.0.0

2 years ago

18.0.0

2 years ago

16.0.3-alpha.0

2 years ago

16.0.0

2 years ago

15.0.4

2 years ago

16.0.1-alpha.0

2 years ago

16.0.2-alpha.0

2 years ago

15.0.2

2 years ago

15.0.3

2 years ago

15.0.1

2 years ago

14.1.0

2 years ago

15.0.0

2 years ago

13.3.3-alpha.0

3 years ago

13.4.0

3 years ago

14.0.0

2 years ago

13.3.3-alpha.1

3 years ago

11.1.8

3 years ago

13.3.2

3 years ago

12.0.3

3 years ago

13.3.1

3 years ago

11.1.6

3 years ago

11.1.7

3 years ago

13.3.0

3 years ago

13.1.0

3 years ago

12.0.1

3 years ago

12.0.2

3 years ago

10.1.3

3 years ago

13.2.0

3 years ago

13.2.1

3 years ago

13.0.0

3 years ago

13.0.1

3 years ago

11.1.5

3 years ago

11.1.3

3 years ago

11.1.4

3 years ago

11.1.2

3 years ago

12.0.0

3 years ago

10.0.2

3 years ago

11.1.1

3 years ago

11.1.0

3 years ago

11.0.0

3 years ago

9.9.4

3 years ago

10.1.2

3 years ago

9.4.2

3 years ago

10.1.1

3 years ago

9.4.1

3 years ago

10.0.0

3 years ago

10.0.1

3 years ago

9.9.1

3 years ago

9.7.1

3 years ago

10.1.0

3 years ago

9.9.2

3 years ago

9.9.3

3 years ago

9.2.4

3 years ago

9.2.3

4 years ago

10.0.0-beta.0

3 years ago

9.9.0

4 years ago

9.8.0

4 years ago

9.7.0

4 years ago

9.6.0

4 years ago

9.6.0-alpha.1

4 years ago

9.5.0

4 years ago

9.4.0

4 years ago

9.2.2

4 years ago

8.1.2

4 years ago

9.2.1

4 years ago

9.3.0

4 years ago

9.2.0

4 years ago

8.1.1

4 years ago

9.1.0

4 years ago

8.1.0

4 years ago

9.0.1

4 years ago

9.0.0

4 years ago

8.0.0

4 years ago

6.0.1

4 years ago

7.2.0

4 years ago

7.1.0

4 years ago

7.0.0

4 years ago

6.0.0

4 years ago

5.0.1

4 years ago

5.0.0

4 years ago

4.0.0

5 years ago

3.0.1

5 years ago

2.0.8

5 years ago

3.0.0

5 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.24.0

5 years ago

1.23.2

5 years ago

1.23.1

5 years ago

1.23.0

5 years ago

1.22.1

5 years ago

1.22.0

5 years ago

1.21.0

5 years ago

1.20.0

5 years ago

1.19.0

5 years ago

1.18.0-alpha.1

5 years ago

1.18.0-alpha.0

5 years ago