Skip to content

refactor: optimize SFTP file transfers using std::io::copy#133

Merged
Cleboost merged 2 commits into
masterfrom
refactor/sftp-transfer-optimization
May 10, 2026
Merged

refactor: optimize SFTP file transfers using std::io::copy#133
Cleboost merged 2 commits into
masterfrom
refactor/sftp-transfer-optimization

Conversation

@Cleboost
Copy link
Copy Markdown
Owner

This pull request refactors the SFTP file transfer logic to simplify the code and improve efficiency by using std::io::copy for file transfers instead of manual buffer management. It also updates the synchronous download function to take ownership of its parameters and a Tokio runtime handle, aligning its API with async best practices. The file explorer UI is updated to use the new function signature.

SFTP file transfer improvements:

  • Replaced manual read/write buffer loops with std::io::copy in both upload_file, download_file, and download_file_sync for more concise and efficient file transfer code. [1] [2]
  • Updated download_file_sync to accept a Tokio runtime handle and take ownership of its parameters, improving its API and thread safety.

UI integration updates:

  • Modified the file explorer to pass the current Tokio runtime handle and owned parameters to the new download_file_sync signature, ensuring compatibility with the refactored SFTP logic.

@Cleboost Cleboost merged commit 151dccd into master May 10, 2026
1 check passed
@Cleboost Cleboost deleted the refactor/sftp-transfer-optimization branch May 10, 2026 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant