Skip to main content

sftpUpload()

Uploads a file from the local file system to the remote file system using SFTP.

Signature

Parameters

string
required
The path of the file on the local file system to upload.
string
required
The destination path of the file on the remote server.
CallbackFunction<void>
Optional callback function to be called after the upload is complete or an error occurs.

Returns

Promise<void>
A promise that resolves when the upload is complete, or rejects with an error if the operation fails.

Example


sftpCancelUpload()

Cancels the ongoing SFTP upload.

Signature

Parameters

None

Returns

void
This method does not return a value.

Example


sftpDownload()

Downloads a file from the remote server using SFTP.

Signature

Parameters

string
required
The path of the file on the remote server to download.
string
required
The destination path where the file will be saved locally.
CallbackFunction<string>
Optional callback function to handle the result of the download.

Returns

Promise<string>
A promise that resolves with the local file path when the download is complete, or rejects with an error if the operation fails.

Example


sftpCancelDownload()

Cancels the ongoing SFTP download operation.

Signature

Parameters

None

Returns

void
This method does not return a value.

Example


Progress Events

Both upload and download operations emit progress events that you can listen to using the on() method.

UploadProgress Event

Emitted during file upload operations.

DownloadProgress Event

Emitted during file download operations.

Complete Example with Progress Tracking

Last modified on March 26, 2026