download
Download a file from the server as a Uint8Array.Parameters
The path to the file on the FTP server to download.
Return type
Returns a promise that resolves to the file contents as a Uint8Array.
Example
This method automatically handles stream finalization. For more control over the download stream, use downloadReadable.
upload
Upload a file to the server.Parameters
The path where the file should be saved on the FTP server.
The file contents to upload as a Uint8Array.
Return type
Returns a promise that resolves when the upload is complete.
Example
This method automatically handles stream finalization. For more control over the upload stream, use uploadWritable.
stat
Obtain detailed file information from the FTP server.Parameters
The path to the file or directory on the FTP server.
Return type
Returns a promise that resolves to an FTPFileInfo object containing file metadata.The FTPFileInfo object includes:
size: File size in bytesmtime: Modification timectime: Creation timeisFile: Boolean indicating if this is a fileisDirectory: Boolean indicating if this is a directoryisSymlink: Boolean indicating if this is a symbolic linkftpperms: FTP permissions stringmediaType: Media type if availablecharset: Character set if available- Additional fields depending on server support
Example
This method uses MLST command if supported by the server, otherwise falls back to SIZE and MDTM commands.
size
Get the size of a file in bytes.Parameters
The path to the file on the FTP server.
Return type
Returns a promise that resolves to the file size in bytes.
Example
modified
Get the last modification time of a file.Parameters
The path to the file on the FTP server.
Return type
Returns a promise that resolves to a Date object representing the file’s last modification time.
Example
rename
Rename a file on the server.Parameters
The current path of the file on the FTP server.
The new path for the file on the FTP server.
Return type
Returns a promise that resolves to true when the rename operation succeeds.
Example
rm
Remove a file from the server.Parameters
The path to the file to delete on the FTP server.
Return type
Returns a promise that resolves when the file is successfully deleted.