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
When trying to list the contents of a subdirectory, the .list method completely ignores the path parameter and only lists the CWD. If I cwd to a subdirectory first, and then call list without an additional path argument, it works:
varFTPClient=require('ftp');varc=newFTPClient();c.on('ready',function(){c.list(function(error,items){if(error){returnconsole.log("ERROR: ",error);}console.log("CWD contents:",items.map(function(item){returnitem.name;}));c.list('subdirectory',function(error,items){if(error){returnconsole.log("ERROR: ",error);}// This outputs the exact same items as before, despite having received a custom path parameter:console.log("Subdirectory contents:",items.map(function(item){returnitem.name;}));// If we CWD to the desired subdirectory first, IT WORKS:c.cwd('subdirectory',function(error,items){c.list(function(error,items){if(error){returnconsole.log("ERROR: ",error);}console.log("Subdirectory contents after CWD:",items.map(function(item){returnitem.name;}));});});});});});c.connect({host: 'localhost',port: 21,user: 'ftp',password: 'ftp'});
The text was updated successfully, but these errors were encountered:
When trying to list the contents of a subdirectory, the
.list
method completely ignores the path parameter and only lists the CWD. If Icwd
to a subdirectory first, and then calllist
without an additional path argument, it works:The text was updated successfully, but these errors were encountered: