Sunday, 15 September 2013

node.js (or nwjs) ftp download -


New files must be downloaded from the public FTP:

But I have to break it from the FTP module Can not connect. My code is:

  var url = "ftp://ftp.cmegroup.com/bulletin/"; Var path = requirement ('path'); Var FS = Requirement ('FS'); // var promise = required ('bluebird'); Var Client = Required ('FTP'); Var c = new client (); Var connectionProperties = {host: "ftp.cmegroup.com",}; C.on ('ready', function () {console.log ('ready'); c.list (function (mistake, list) {If (mistake) happens, then list .for (function (element, Index, array) {// ignore directories if (element.type === 'd') {console.log ('directory ignore' element.name); return;} // ungener non pists if path .extname (element.name))! == '.zip') {console.log ('file ignored' + element.name); return;} // Download files c.get (element.name, function (err, Stream) {throwing err; stream; oynes ('close', function () {c.end ();}); stream pip (fs.c ReateWriteStream (element.name));})}});});}); C.connect (connectionProperties);  

Error:

  Unrecognized error: Connectivity Econfusion 127.0.0.121  

Why not understand why

lack of one line

  c.connect (connectionProperties);  

No comments:

Post a Comment