readDir does not work for the specific folder (adding different path than ./ ) with FTP Protocol
yus4u opened this issue · 3 comments
I upgrade the library from 1.0.5 to 1.1.1, I discover the ls function not exist anymore and I have to use the readDir, it works perfectly with the SFTP but when I tried with the FTP, it doesn't work.
I see,
I thought it enough to add the path into the list function.
public readDir(path = './'): Promise {
return this._wrap(
async () => {
const files = await this._sftpClient.readDir(path);
return files.map(file => formatFile(parseList(file.longname)[0]))
},
async () => {
const files = await this._ftpClient.list(path);
return files.map(file => formatFile(file));
},
'files'
);
}
I know now it works but I prefer this code
I was using the path in with the basic-ftp to have a list of files
(https://www.npmjs.com/package/basic-ftp)
**list([path]): Promise<FileInfo[]>
List files and directories in the current working directory, or from the path if specified. Currently, this library only supports Unix- and DOS-style directory listings.**