list
Retrieve a plain directory listing from the server.Parameters
The directory path to list. If not provided, lists the current working directory.
Return type
Returns a promise that resolves to an array of strings, where each string represents a file or directory entry in plain text format.
Example
This method uses the NLST command. For structured data with file metadata, use extendedList instead.
extendedList
Retrieve a detailed directory listing with file metadata.Parameters
The directory path to list. If not provided, lists the current working directory.
Return type
Returns a promise that resolves to an array of tuples. Each tuple contains:
- First element: filename (string)
- Second element: FTPFileInfo object with metadata (size, modification time, permissions, etc.)
Example
This method uses the MLSD command which provides structured machine-readable directory listings.
mkdir
Create a new directory on the server.Parameters
The path of the directory to create on the FTP server.
Return type
Returns a promise that resolves to true when the directory is successfully created.
Example
rmdir
Remove a directory from the server.Parameters
The path of the directory to remove from the FTP server.
Return type
Returns a promise that resolves when the directory is successfully removed.
Example
chdir
Change the current working directory.Parameters
The directory path to change to on the FTP server.
Return type
Returns a promise that resolves when the directory change is complete.
Example
This is equivalent to the Unix cd command. All subsequent operations will be relative to the new directory.
cwd
Get the current working directory path.Return type
Returns a promise that resolves to a string containing the absolute path of the current working directory.
Example
This is equivalent to the Unix pwd command.
cdup
Change to the parent directory.Return type
Returns a promise that resolves when the directory change is complete.
Example
This is equivalent to the Unix command cd ..