You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var Ftp = new JSFtp({
host: "192.168.1.85",
port: 21, // defaults to 21
user: "root", // defaults to "anonymous"
pass: "root" // defaults to "@anonymous"
});
Ftp.list('/a/b', function(err, res) {
res.forEach(function(file) {
console.log(file.name);
});
TypeError: Object drw-rw-rw- 1 user group 0 Nov 28 13:47 .
drw-rw-rw- 1 user group 0 Nov 28 13:47 ..
-rw-rw-rw- 1 user group 9 Nov 28 13:45 file.txt
has no method 'forEach'
at eval (file:///D:/workspace/hzm/hzm_file_client/ftp.html:25:9)
at eval (D:\workspace\hzm\hzm_file_client\node_modules\jsftp\lib\jsftp.js:344:7)
at f (D:\workspace\hzm\hzm_file_client\node_modules\jsftp\node_modules\once\once.js:16:25)
at Array.eval (D:\workspace\hzm\hzm_file_client\node_modules\jsftp\lib\jsftp.js:325:5)
at Ftp.parse (D:\workspace\hzm\hzm_file_client\node_modules\jsftp\lib\jsftp.js:221:13)
at Ftp.parseResponse (D:\workspace\hzm\hzm_file_client\node_modules\jsftp\lib\jsftp.js:136:8)
at Stream.eval (D:\workspace\hzm\hzm_file_client\node_modules\jsftp\lib\jsftp.js:107:24)
at Stream.EventEmitter.emit (events.js:95:17)
at ResponseParser.reemit (D:\workspace\hzm\hzm_file_client\node_modules\jsftp\node_modules\event-stream\node_modules\stream-combiner\node_modules\duplexer\index.js:70:25)
at ResponseParser.EventEmitter.emit (events.js:95:17)
The text was updated successfully, but these errors were encountered:
Ftp.list returns a string of the listing, not an Array.
Ftp.ls is always a better idea to get an array of a file listing, and also will use stat command internally if it is available in your FTP server, which will make retrieval faster.
var JSFtp = require("jsftp");
var Ftp = new JSFtp({
host: "192.168.1.85",
port: 21, // defaults to 21
user: "root", // defaults to "anonymous"
pass: "root" // defaults to "@anonymous"
});
Ftp.list('/a/b', function(err, res) {
res.forEach(function(file) {
console.log(file.name);
});
TypeError: Object drw-rw-rw- 1 user group 0 Nov 28 13:47 .
drw-rw-rw- 1 user group 0 Nov 28 13:47 ..
-rw-rw-rw- 1 user group 9 Nov 28 13:45 file.txt
has no method 'forEach'
at eval (file:///D:/workspace/hzm/hzm_file_client/ftp.html:25:9)
at eval (D:\workspace\hzm\hzm_file_client\node_modules\jsftp\lib\jsftp.js:344:7)
at f (D:\workspace\hzm\hzm_file_client\node_modules\jsftp\node_modules\once\once.js:16:25)
at Array.eval (D:\workspace\hzm\hzm_file_client\node_modules\jsftp\lib\jsftp.js:325:5)
at Ftp.parse (D:\workspace\hzm\hzm_file_client\node_modules\jsftp\lib\jsftp.js:221:13)
at Ftp.parseResponse (D:\workspace\hzm\hzm_file_client\node_modules\jsftp\lib\jsftp.js:136:8)
at Stream.eval (D:\workspace\hzm\hzm_file_client\node_modules\jsftp\lib\jsftp.js:107:24)
at Stream.EventEmitter.emit (events.js:95:17)
at ResponseParser.reemit (D:\workspace\hzm\hzm_file_client\node_modules\jsftp\node_modules\event-stream\node_modules\stream-combiner\node_modules\duplexer\index.js:70:25)
at ResponseParser.EventEmitter.emit (events.js:95:17)
The text was updated successfully, but these errors were encountered: