Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why? #72

Closed
ljie opened this issue Nov 28, 2013 · 1 comment
Closed

why? #72

ljie opened this issue Nov 28, 2013 · 1 comment

Comments

@ljie
Copy link

ljie commented Nov 28, 2013

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)

@sergi
Copy link
Owner

sergi commented Jan 12, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants