FTPClient » Directory
Lists the files and folders under a directory. Returns a JSON array of directory items.
js
client.Directory(remoteDirectory);
Parameters
remoteDirectory
- The directory to list items of.
Example
js
let client = ftp.Connect(
"sftp",
"example.domain.com",
22,
"brad",
"password"
);
if (client.IsConnected()) {
let list = JSON.parse(client.Directory('/remote/path'));
console.log(list);
}
Result:
json
[
{
"name": "a_folder",
"isDirectory": true
},
{
"name": "pub",
"isDirectory": true
},
{
"name": "readme.txt",
"isDirectory": false
}
]