将file upload到node.js中的ftp服务器

我正在尝试使用node.js在ftp服务器上传文件,如下所示 –

我正在使用库 – https://github.com/sergi/jsftp

var fs = require('fs'); var Ftp = new JSFtp({ host: "ftp.some.net", port: 21, // defaults to 21 user: "username", // defaults to "anonymous" pass: "pass", debugMode: true // defaults to "@anonymous" }); 

上传文件 –

 exports.UploadToFtP = function (req, res) { Ftp.put('public/Test.html', '/Test/index.html', function (err) { if (!err) res.send(200); else res.send(err); }); }; 

我试着用上面的这个方法上传文件,它用200 OK来回应我。 但是我没有在服务器上的文件。 这是否必须做一些连接时间外的服务器? 为什么这不是在服务器上写文件?

如果打开debugging模式,则jsftp实例将发出jsftp_debug事件。

为了反应打印所有的debugging事件,我们会听到像这样的debugging消息:

 Ftp.on('jsftp_debug', function(eventType, data) { console.log('DEBUG: ', eventType); console.log(JSON.stringify(data, null, 2)); });