features(): Promise<Map<string, string>>
Get a description of supported features. This will return a Map where keys correspond to FTP commands and values contain further details. If the FTP server doesn't support this request you'll still get an empty Map instead of an error response.
send(command): Promise<FTPResponse>
Send an FTP command and return the first response.
sendIgnoringError(command): Promise<FTPResponse>
Send an FTP command, return the first response, and ignore an FTP error response. Any other error or timeout will still reject the Promise.
cd(path): Promise<FTPResponse>
Change the current working directory.
pwd(): Promise<string>
Get the path of the current working directory.
list([path]): Promise<FileInfo[]>
List files and directories in the current working directory, or at path if specified. Currently, this library only supports MLSD, Unix and DOS directory listings. See FileInfo for more details.
lastMod(path): Promise<Date>
Get the last modification time of a file. This command might not be supported by your FTP server and throw an exception.
size(path): Promise<number>
Get the size of a file in bytes.
rename(path, newPath): Promise<FTPResponse>
Rename a file. Depending on the server you may also use this to move a file to another directory by providing full paths.
remove(path): Promise<FTPResponse>
Remove a file.
uploadFrom(readableStream | localPath, remotePath, [options]): Promise<FTPResponse>
Upload data from a readable stream or a local file to a remote file. If such a file already exists it will be overwritten. If a file is being uploaded, additional options offer localStart and localEndInclusive to only upload parts of it.
appendFrom(readableStream | localPath, remotePath, [options]): Promise<FTPResponse>
Upload data from a readable stream or a local file by appending it to an existing file. If the file doesn't exist the FTP server should create it. If a file is being uploaded, additional options offer localStart and localEndInclusive to only upload parts of it. For example: To resume a failed upload, request the size of the remote, partially uploaded file using size() and use it as localStart.
downloadTo(writableStream | localPath, remotePath, startAt = 0): Promise<FTPResponse>
Download a remote file and pipe its data to a writable stream or to a local file. You can optionally define at which position of the remote file you'd like to start downloading. If the destination you provide is a file, the offset will be applied to it as well. For example: To resume a failed download, request the size of the local, partially downloaded file and use that as startAt.