ssh2-sftp-client | a client for SSH2 SFTP

 by   theophilusx JavaScript Version: 10.0.3 License: Apache-2.0

kandi X-RAY | ssh2-sftp-client Summary

kandi X-RAY | ssh2-sftp-client Summary

ssh2-sftp-client is a JavaScript library. ssh2-sftp-client has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can install using 'npm i ssh2-sftp-client-with-remote-path-sep' or download it from GitHub, npm.

an SFTP client for node.js, a wrapper around SSH2 which provides a high level convenience abstraction as well as a Promise based API. Documentation on the methods and available options in the underlying modules can be found on the SSH2 project pages. Current stable release is v7.2.2. Code has been tested against Node versions 14.18.3, 16.13.2 and 17.4.0. Node versions < 10.x are not supported.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              ssh2-sftp-client has a low active ecosystem.
              It has 707 star(s) with 175 fork(s). There are 14 watchers for this library.
              There were 3 major release(s) in the last 12 months.
              There are 5 open issues and 404 have been closed. On average issues are closed in 35 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of ssh2-sftp-client is 10.0.3

            kandi-Quality Quality

              ssh2-sftp-client has 0 bugs and 0 code smells.

            kandi-Security Security

              ssh2-sftp-client has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              ssh2-sftp-client code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              ssh2-sftp-client is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              ssh2-sftp-client releases are available to install and integrate.
              Deployable package is available in npm.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ssh2-sftp-client
            Get all kandi verified functions for this library.

            ssh2-sftp-client Key Features

            No Key Features are available at this moment for ssh2-sftp-client.

            ssh2-sftp-client Examples and Code Snippets

            No Code Snippets are available at this moment for ssh2-sftp-client.

            Community Discussions

            QUESTION

            Nodejs: Not able to download file from sftp server
            Asked 2021-Feb-23 at 16:12

            I'm trying to download files from sftp in nodejs, I created sftp using springboot I'm able to connect and do get() and put() operation using python/Winscp/ssh commands.

            I'm able to connect with my SFTP server but its not downloading the file, it just create empty file in my directory with 0 KB size. I'm not sure what's wrong. It is working if I don't run this in a loop or I have only one file.

            I have tried almost all the answers on stack overflow but nothing works for me.

            ...

            ANSWER

            Answered 2021-Feb-23 at 16:12

            Did not found the solution.

            The ugly solution was to downloaded the whole directory from SFTP instead of downloading file one by one.

            Source https://stackoverflow.com/questions/66178973

            QUESTION

            How to upload file from S3 bucket to server (SFTP) in NodeJS?
            Asked 2021-Feb-05 at 18:16

            I am trying to use ssh2-sftp-client in NodeJS to send a file from an S3 bucket in AWS to my server. I have seen many examples and I have tried them all with no success. I feel that this one is close but still is not working for me:

            ...

            ANSWER

            Answered 2021-Feb-05 at 18:16

            I figured it out. Not sure where exactly the problem was but this will successfully pull a file from S3 and then upload to SFTP server:

            Source https://stackoverflow.com/questions/66067063

            QUESTION

            Filter condition for uploaDir using ssh2-sftp-client (NodeJS) for only certain files
            Asked 2021-Jan-18 at 14:48

            In my nodejs code I am using ssh2-sftp-client (https://github.com/theophilusx/ssh2-sftp-client) to transfer some files to a remote server :

            The files in my directory are like :

            ...

            ANSWER

            Answered 2021-Jan-18 at 14:48

            Worked with version 6.0.0 of ssh2-sftp-client

            Source https://stackoverflow.com/questions/65772283

            QUESTION

            Why are outbound SSH connections from Google CloudRun to EC2 instances unspeakably slow?
            Asked 2020-Dec-12 at 21:23

            I have a Node API deployed to Google CloudRun and it is responsible for managing external servers (clean, new Amazon EC2 Linux VM's), including through SSH and SFTP. SSH and SFTP actually work eventually but the connections take 2-5 MINUTES to initiate. Sometimes they timeout with handshake timeout errors.

            The same service running on my laptop, connecting to the same external servers, has no issues and the connections are as fast as any normal SSH connection.

            The deployment on CloudRun is pretty standard. I'm running it with a service account that permits access to secrets, etc. Plenty of memory allocated.

            I have a VPC Connector set up, and have routed all traffic through the VPC connector, as per the instructions here: https://cloud.google.com/run/docs/configuring/static-outbound-ip

            I also tried setting UseDNS no in the /etc/ssh/sshd_config file on the EC2 as per some suggestions online re: slow SSH logins, but that has not make a difference.

            I have rebuilt and redeployed the project a few dozen times and all tests are on brand new EC2 instances.

            I am attempting these connections using open source wrappers on the Node ssh2 library, node-ssh and ssh2-sftp-client.

            Ideas?

            ...

            ANSWER

            Answered 2020-Dec-12 at 21:23

            Cloud Run works only until you have a HTTP request active.

            You proably don't have an active request during this on Cloud Run, as outside of the active request the CPU is throttled.

            Best for this pipeline is Cloud Workflows and regular Compute Engine instances.

            You can setup a Workflow to start a Compute Engine for this task, and stop once it finished doing the steps.

            I am the author of article: Run shell commands and orchestrate Compute Engine VMs with Cloud Workflows it will guide you how to setup.

            Executing the Workflow can be triggered by Cloud Scheduler or by HTTP ping.

            Source https://stackoverflow.com/questions/65209703

            QUESTION

            Jest test a function integrated with the ssh2-sftp-client library
            Asked 2020-Nov-14 at 21:39

            I need to test a function that write a file from local path to remote path on an sftp machine using shh2-sftp-client library.

            my own function is the following:

            ...

            ANSWER

            Answered 2020-Nov-14 at 21:39

            I hope it will be useful to others, but I have found the solution. I always defined the mock by default, but then I invoked the mockImplementation() method on the instance of the ssh2-sftp-client library class, mocking the single functions. For each test I overwrite the return value of each function.

            Here an example:

            Source https://stackoverflow.com/questions/64829401

            QUESTION

            How to download multiple files with ssh2-sftp-client fastGet?
            Asked 2020-Jul-08 at 20:45

            How do you download multiple txt files with fastGet? My code is as follows:

            ...

            ANSWER

            Answered 2020-Jul-08 at 20:45

            There seem to be multiple issues in your code:

            1. The loop through files should be executed in the first then block itself.
            2. sftp.fastGet returns a promise, hence its an asynchronous, operation, and executing asynchronous operations inside a forEach loop is not a good idea.

            I would recommend updating your code with following changes:

            Source https://stackoverflow.com/questions/62802860

            QUESTION

            Node.js - ssh2-sftp-client getting multiple files error
            Asked 2020-Jun-11 at 17:55

            I use ssh2-sftp-client to get some files. If I use sftp.end(); at the end I get this error in the console:

            ...

            ANSWER

            Answered 2020-Jun-10 at 21:07

            What I believe is currently happening is that since you're not returning a Promise from your second then(), the third then() gets resolved immediately (with a value of undefined), which causes your connection to get terminated immediately (before your fastGet()s have time to finish).

            To fix this, you would need to explicitly return a Promise from your second then() that only gets resolved once all of the files have been transferred. You may also want to consider rejecting that promise if at least one of the transfers fails.

            Source https://stackoverflow.com/questions/62309198

            QUESTION

            Error: Connecting to a SFTP server with ssh2-sftp-client in a AWS lambda function throws a time out
            Asked 2020-Jun-04 at 10:26

            I'm trying to connect to a SFTP-Server and list the documents in the /ARCHIVE Folder. Credentials are stored in a .env file. When I run this on my local machine it works and lists the documents.

            ...

            ANSWER

            Answered 2020-Jun-04 at 08:52

            The issue could be that your Lambda function does not have access to the SFTP host.

            Is this SFTP server hosted outside of AWS or within your account ?

            If it's hosted in the internet and not by you on AWS, you can do the following:

            1. Create a public VPC [Skip this if you already have a public VPC]
            2. Add a NAT Gateway in that public VPC [Also skip this if you already have a NAT Gateway]
            3. In the VPC where your Lambda function resides, add a route table which redirects traffic to the NAT Gateway by setting the destination as 0.0.0.0/0 and the target as your NAT Gateway which we created in step 2.

            You can find a detailed answer on how to add internet connection to your Lambda function by visiting this AWS article: How do I give internet access to my Lambda function in a VPC?

            If the SFTP server is already hosted by you in AWS, you can simply add access to it by using AWS security group.

            Check this article on how to connect Lambda with another AWS service (it's using RDS but you can follow the same logic with your SFTP server): Configuring a Lambda function to access Amazon RDS in an Amazon VPC

            Also, make sure you set the Lambda timeout to be long enough to allow connecting and exchange data with an external SFTP server.

            Source https://stackoverflow.com/questions/62190224

            QUESTION

            Programmatically move files from an S3 bucket to a Windows EC2 and vice-versa
            Asked 2020-May-03 at 15:17

            I want to push files to a Windows EC2 and also get folders from my EC2 and store it in S3. As I have many EC2s, I wanted to automate this - I currently have a Node.js server on ECS that uses ssh2-sftp-client library. With the following piece of code I'm able to push files into it (similarly, I'm able to extract files from it and upload it to S3):

            ...

            ANSWER

            Answered 2020-May-03 at 15:17

            One good way to automate the running of scripts on EC2 is to use SSM Run Command. If you set up each EC2 instance correctly, then it becomes a managed instance and you can trigger the running of scripts across a fleet of EC2 instances, chosen by tags, for example.

            Source https://stackoverflow.com/questions/61504091

            QUESTION

            unable to exit my process after completion. NodeJS
            Asked 2020-Mar-18 at 21:37

            I'm working on a Node JS program to connect to a remote SFTP server to copy log files. I'm using this NPM package. ssh2-sftp-client

            ...

            ANSWER

            Answered 2020-Mar-17 at 22:59

            In short, when you have a "chain" of promises (a.then(() => b.then(() =>...) and you want to do something at the end of them, you simply add that thing to the last .then callback.

            However, if you're making multiple promises, you need to wait until all of them are finished, which you can do using Promise.all (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all):

            Source https://stackoverflow.com/questions/60731275

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install ssh2-sftp-client

            You can install using 'npm i ssh2-sftp-client-with-remote-path-sep' or download it from GitHub, npm.

            Support

            The connection options are the same as those offered by the underlying SSH2 module. For full details, please see SSH2 client methods. All the methods will return a Promise, except for on() and removeListener(), which are typically only used in special use cases.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • npm

            npm i ssh2-sftp-client

          • CLONE
          • HTTPS

            https://github.com/theophilusx/ssh2-sftp-client.git

          • CLI

            gh repo clone theophilusx/ssh2-sftp-client

          • sshUrl

            git@github.com:theophilusx/ssh2-sftp-client.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Reuse Pre-built Kits with ssh2-sftp-client

            Consider Popular JavaScript Libraries

            freeCodeCamp

            by freeCodeCamp

            vue

            by vuejs

            react

            by facebook

            bootstrap

            by twbs

            Try Top Libraries by theophilusx

            javaSpeak

            by theophilusxC

            bsbingo

            by theophilusxJavaScript

            easy-postgres

            by theophilusxJavaScript

            file-mode.js

            by theophilusxJavaScript

            github-npm-report

            by theophilusxJavaScript