JSFTP module works locally but not when uploaded to AppFog?

41 views
Skip to first unread message

William Anderson

unread,
Nov 28, 2014, 4:39:16 PM11/28/14
to appfog...@googlegroups.com
Edit: Accidentally left login info in the original post.

My Node.js application uses the JSFTP module to connect to a remote server via FTP and download database exports that are then used to update our own database. I realize that AppFog does not support FTP, but does that apply to applications? I'm not trying to connect to AppFog via Filezilla or anything like that. To my knowledge our access to this remote server is limited to FTP. We originally asked for an API to their database, but the best they could provide were daily CSV exports (ick!). I've included a snippet of my code below, which works fine locally:

var ftp = new JSFtp({
        host: 'host',
        user: 'user',
        pass: 'pass'
    });

var download = function(){
                console.log('enters download');
                var d = q.defer();
                var i = 1;
                var files = [];
                var ftpGet = function(){
                    var number = i++;
                    var filename = school+'_export'+number+'.csv';
                    ftp.get(filename, filename, function(hadErr){
                        console.log('enters get')
                        if (hadErr){
                            d.reject(err);
                            console.error('There was an error retrieving ' + filename);
                        }else{
                            files.push(filename);
                            console.log(filename + ' downloaded');
                            if(i <= 5){
                                ftpGet();
                            }else{
                                d.resolve(files);
                            }
                        }
                    });
                }
                ftpGet();  
                return d.promise;


Reply all
Reply to author
Forward
0 new messages