Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ssh2-sftp-client

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssh2-sftp-client

ssh2 sftp client for node

  • 11.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
607K
decreased by-4.45%
Maintainers
1
Weekly downloads
 
Created

What is ssh2-sftp-client?

The ssh2-sftp-client npm package is a promise-based SFTP client for Node.js, built on top of the ssh2 module. It provides a simple and easy-to-use interface for performing various SFTP operations such as uploading, downloading, listing, and deleting files on a remote server.

What are ssh2-sftp-client's main functionalities?

Connecting to an SFTP server

This feature allows you to establish a connection to an SFTP server using the provided host, port, username, and password.

const Client = require('ssh2-sftp-client');
const sftp = new Client();

sftp.connect({
  host: 'example.com',
  port: '22',
  username: 'username',
  password: 'password'
}).then(() => {
  console.log('Connected');
}).catch(err => {
  console.error(err.message);
});

Uploading a file

This feature allows you to upload a file from your local system to the remote SFTP server.

sftp.put('local/path/to/file.txt', 'remote/path/to/file.txt').then(() => {
  console.log('File uploaded');
}).catch(err => {
  console.error(err.message);
});

Downloading a file

This feature allows you to download a file from the remote SFTP server to your local system.

sftp.get('remote/path/to/file.txt', 'local/path/to/file.txt').then(() => {
  console.log('File downloaded');
}).catch(err => {
  console.error(err.message);
});

Listing files in a directory

This feature allows you to list all files and directories in a specified remote directory.

sftp.list('remote/path/to/directory').then(data => {
  console.log(data);
}).catch(err => {
  console.error(err.message);
});

Deleting a file

This feature allows you to delete a specified file from the remote SFTP server.

sftp.delete('remote/path/to/file.txt').then(() => {
  console.log('File deleted');
}).catch(err => {
  console.error(err.message);
});

Other packages similar to ssh2-sftp-client

Keywords

FAQs

Package last updated on 07 Aug 2024

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc