'How to connect ftps using node and upload the files

I am new in node.js. I want to connect ftps://ftp.XXX.XXX using node.js in a passive mode. After a successful connection I want to upload local files to connected ftps.

My code below is working for the ftp but showing timeout for ftps://ftp.XXX.XXX.

var  Client = require('ssh2-sftp-client');

 const config = {
        host: 'XXX.XXXX.net',
        username: 'XXXXX',
        password: 'XXXXX',
        port: 22

      };
     let status= await sftp.connect(config)
    .then(() => {
        console.log('filename===>'+filename); 
        console.log('fullpath===>'+fullpath); 
        sftp.fastPut(fullpath, '/path/to/remote/dir'+filename);
        return 1;
    }).catch(err => {
       console.error(err.message);
        return 0;
    });


Solution 1:[1]

This issue has been resolve. Actually I am trying to connect box.com ftps account and they have provided the hooks on event of upload so I have used those hook to implement functionality

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Somnath Rokade