[英]spaces in url ftp client in node.js
I use ftp Node.js and I'm able to read files and folders but only folders in their URLs there is no spaces. 我使用ftp Node.js,可以读取文件和文件夹,但只有URL中的文件夹没有空格。
this works : 这有效 :
var ftp = require('ftp');
var path = "app/LaundryMachine";
var client = new ftp();
//connect properties
var config = {
host: '***.net',
port: 21,
user: '***',
password: '***'
};
client.on('ready', function () {
client.list(path, function (err, list) {
if (err) throw err;
for (var i in list) {
console.log(list[i].name);
}
client.end();
});
});
client.connect(config);
but, if the var path have space it's not work . 但是,如果var路径中有空格,则无法使用 。
var path = "app/Laundry Machine";
I try to put %20 or +, but still not. 我尝试输入%20或+,但仍然没有。
You can use listSafe method instead of list. 您可以使用listSafe方法代替list。
From npmjs.org/package/ftp 从npmjs.org/package/ftp
"This is useful for servers that do not handle characters like spaces and quotes in directory names well for the LIST command." “这对于不能很好地处理LIST命令的目录名称中的空格和引号等字符的服务器很有用。”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.