basic-ftp | FTP client for Node.js , supports FTPS | HTTP library

 by   patrickjuchli TypeScript Version: 5.0.5 License: MIT

kandi X-RAY | basic-ftp Summary

kandi X-RAY | basic-ftp Summary

basic-ftp is a TypeScript library typically used in Networking, HTTP, Nodejs applications. basic-ftp has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

The first example will connect to an FTP server using TLS, get a directory listing, upload a file and download it as a copy. Note that the FTP protocol doesn't allow multiple requests running in parallel. The next example deals with directories and their content. First, we make sure a remote path exists, creating all directories as necessary. Then, we make sure it's empty and upload the contents of a local directory. If you encounter a problem, it may help to log out all communication with the FTP server.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              basic-ftp has a low active ecosystem.
              It has 499 star(s) with 61 fork(s). There are 10 watchers for this library.
              There were 1 major release(s) in the last 12 months.
              There are 15 open issues and 158 have been closed. On average issues are closed in 20 days. There are 3 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of basic-ftp is 5.0.5

            kandi-Quality Quality

              basic-ftp has no bugs reported.

            kandi-Security Security

              basic-ftp has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              basic-ftp is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              basic-ftp releases are available to install and integrate.
              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 basic-ftp
            Get all kandi verified functions for this library.

            basic-ftp Key Features

            No Key Features are available at this moment for basic-ftp.

            basic-ftp Examples and Code Snippets

            No Code Snippets are available at this moment for basic-ftp.

            Community Discussions

            QUESTION

            I am new to streams and i have requirement to download file from ftp and send as a stream to azure stageblock(npm @azure/storage-blob)
            Asked 2020-Jun-25 at 06:50

            ftp sends data in a writable stream and azure stageblock method accepts data in readable stream and when i am trying to save data i am getting error. Error: body must be a string, Blob, ArrayBuffer, ArrayBufferView, or a function returning NodeJS.ReadableStream.

            ...

            ANSWER

            Answered 2020-Jun-25 at 06:50

            According to my test, we can use the following code to download files from FTP server then upload file to Azure blob

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

            QUESTION

            ftp directory download triggers maximum call stack exceeded error
            Asked 2019-Nov-07 at 18:49

            I'm currently working on a backup script with NodeJS. The script downloads a directory and its files und subdirectories recursively using FTP/FTPS. I'm using the basic-ftp package to do the FTP calls.

            When I try to download a big directory with a lot of subdirectories, I get the Maximum call stack size exceeded error, but I don't find why and where it happens. I don't see any infinity loop or any missing return calls. After hours of debugging, I have no more ideas.

            I don't use the downloadDirTo method from basic-ftp, because I don't want to stop downloading after a error happend. When an error occures it should keep going and it should add the error to the log file.

            The repository is here: https://github.com/julianpoemp/webspace-backup.

            As soon as the FTPManager is ready, I call the doBackup method (see method in BackupManager). This method calls the downloadFolder method defined in FTPManager.

            ...

            ANSWER

            Answered 2019-Nov-06 at 00:53
            Problem

            Inside the FtpManager.downloadFolder function, I see recursive calls to the same downloadFolder method with an await. Your Maximum call stack exceeded error could come from there, since your initial call will need to keep everything in memory while traversing all subdirectories.

            Proposed solution

            Instead of awaiting everything recursively, you could setup a queue system, with an algorithm like this:

            • Add the current folder to a queue
            • While that queue is not empty:
              • Get the first folder in the queue (and remove it from it)
              • List all entries in it
              • Download all files
              • Add all subfolders to the queue

            This allows you to download a lot of folders in a loop, instead of using recursion. Each loop iteration will run independently, meaning that the result of the root directory download won't depend on the deeeeeep file tree inside it.

            Using a queue manager

            There are plenty of queue manager modules for NodeJS, which allow you to have concurrency, timeouts, etc. One I've used in the past is simply named queue. It has a lot of useful features, but will require a little more work to implement in your project. Hence, for this answer, I used no external queue module, so that you can see the logic behind it. Feel free to search for queue, job, concurrency...

            Example

            I wanted to implement that logic directly into your own code, but I don't use Typescript, so I thought I'd make a simple folder copy function, which uses the same logic.

            Note: For simplicity, I've not added any error handling, this is just a proof of concept! You can find a demo project which uses this here on my Github.

            Here is how I've done it:

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

            QUESTION

            FTP in AWS Lambda - Issues Downloading Files (Async/Await)
            Asked 2019-Mar-02 at 19:14

            I have been struggling with various FTP Node modules to try and get anything working in AWS Lambda. The best and most popular seems to be "Basic-FTP" that also supports async/await. But I just cannot get it to download files when any code is added beneath the FTP function.

            I don't want to add the fs functions within the FTP async function as I need to solve what is causing the break when any code below is added and I also have other bits of code to add and work with the downloaded file and it's content later:

            FTP SUCCESS - When the async function is used only with no fs code beneath it

            FTP FAILURE - Adding the fs readdir/readFile functions or any other code below

            ERROR Error: ENOENT: no such file or directory, open '/tmp/document.txt'

            https://github.com/patrickjuchli/basic-ftp

            ...

            ANSWER

            Answered 2019-Mar-02 at 19:14

            The problem is that you are getting lost when creating an async function inside your handler. Since example() is async, it returns a Promise. But you don't await on it, so the way it has been coded, it's kind of a fire and forget thing. Also, your Lambda is being terminated before your callbacks are triggered, so even if it got to download you would not be able to see it.

            I suggest you wrap your callbacks in Promises so you can easily await on them from your handler function.

            I have managed to make it work: I have used https://dlptest.com/ftp-test/ for testing, so change it accordingly. Furthermore, see that I have uploaded the file myself. So if you want to replicate this example, just create a readme.txt on the root of your project and upload it. If you already have this readme.txt file on your FTP server, just delete the line where it uploads the file.

            Here's a working example:

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

            QUESTION

            Download txt file via FTP with Async & Promises in Node and AWS Lambda
            Asked 2019-Feb-18 at 21:11

            I am using a single Node module basic-ftp to download a txt file in AWS Lambda and place it in the /tmp/ directory within the Lambda function.

            I then want to work with the txt file and its contents outside of the FTP function.

            I am using Async and Promises and have got a bit lost with the code. The current error returned in AWS Lambda is

            ...

            ANSWER

            Answered 2019-Feb-18 at 21:11

            finalData is only defined within example which returns it, but you're not assigning this to anything. Combined with Luca Kiebel's comment, try adding

            const finalData = await example();

            then log that out.

            Because finalData is defined within the function example, it is only available within that function and any function defined within that function.

            You Don't Know JS explains this better than I can

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

            QUESTION

            Download file via FTP, write to /tmp/ and output .txt contents to the console with AWS Lambda
            Asked 2019-Feb-15 at 23:42

            I am using just a single Node package, basic-ftp to try and download a TXT file and write the contents to the console. Further down the line I will be editing the text so will need to use fs. Just struggling to work with the output from createWriteStream from within the FTP program.

            Can anyone help me write a TXT file to the /tmp/ file within AWS Lambda and then the correct syntax to open and edit the file after createWriteStream has been used?

            ...

            ANSWER

            Answered 2019-Feb-15 at 23:42

            Pretty sure your fs.createWriteStream() has to use an absolute path to /tmp in Lambdas. Your actual working directory is var/task not /.

            Also, if you're using fs.createWriteStream() you'll need to wait for the finish event before reading from the file. Somethign like this...

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

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

            Vulnerabilities

            No vulnerabilities reported

            Install basic-ftp

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            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 basic-ftp

          • CLONE
          • HTTPS

            https://github.com/patrickjuchli/basic-ftp.git

          • CLI

            gh repo clone patrickjuchli/basic-ftp

          • sshUrl

            git@github.com:patrickjuchli/basic-ftp.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