mscdex / node-ftp

An FTP client module for node.js
MIT License
1.13k stars 243 forks source link

.rename() returns string as first argument. #102

Open RWOverdijk opened 10 years ago

RWOverdijk commented 10 years ago

The README states that rename's callback has 1 parameter, being error:

callback has 1 parameter: < Error >err.

However, I'm getting: Rename successful.

RWOverdijk commented 10 years ago

Update: My arguments: { '0': 'Rename successful', '1': 250 }

So there are two callback arguments, not one, and neither is an error.

Another update I'm using this with async.waterfall. So I actually get three arguments, but the third is callback.

mscdex commented 10 years ago

Yeah, some methods pass the callback directly to the "parser code", which actually passes (err, text, statusCode) (because some methods need to parse the response text and/or check the status code), instead of wrapping the callback and only passing the err argument.

Unfortunately at this point changing the behavior could break things if other users are relying on those other arguments being passed to their callbacks.

This is just one of those things where waterfall() can trip you up because some libraries do similar things where they only document the necessary callback arguments.

I'll see what I can do about this without having to break compatibility.