7 Commits

Author SHA1 Message Date
mus65 0ff2c50765 SftpClient: add IProgress to DownloadFileAsync and UploadFileAsync (#1771)
* SftpClient: add DownloadFileAsync overload with downloadCallback

fixes #1765

* Change to IProgress and also add to UploadFileAsync
2026-03-16 19:47:59 +01:00
Rob Hague dccdedc36e Build the read-ahead mechanism into SftpFileStream (#1705)
* Build the read-ahead mechanism into SftpFileStream

This change unifies the SFTP download implementations that exist via DownloadFile and
via SftpFileStream, by rewriting SftpFileStream to perform the same "read-aheads" as
DownloadFile. This brings the performance of downloads via SftpFileStream in line with
DownloadFile, such that the latter is now effectively SftpFileStream.CopyTo. It also
brings the recently added DownloadFileAsync up to speed since that was implemented via
SftpFileStream.CopyToAsync.

The methodology is a mix of the previous one and that within OpenSSH: the first call to
SftpFileStream.Read sends one read request to the server. The second sends two and when
not interrupted by Write or similar, the number of in-flight read requests continues to
scale up in this fashion.

I have measured CopyTo to be 3-20x faster than before, depending on file size and server
round-trip time.

* Check CanSeek in ReadAllBytes

* Squeeze out some performance
2025-10-22 19:55:13 +02:00
dependabot[bot] 03ae6bfa0f Bump dependencies (#1682)
* Bump the dependencies group with 4 updates

Bumps BouncyCastle.Cryptography from 2.6.1 to 2.6.2
Bumps Meziantou.Analyzer from 2.0.205 to 2.0.210
Bumps MSTest from 3.9.3 to 3.10.0
Bumps SonarAnalyzer.CSharp from 10.13.0.120203 to 10.15.0.120848

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
2025-08-02 17:57:09 +02:00
Noah Dela Rosa d08c4aaa8a Add UploadFileAsync and DownloadFileAsync methods (#1634)
* add interface methods

* add internal file methods

* impl interface methods

* tweak buffer size usage

* swap tests with async upload

* swap more upload file references

* add async download tests

* add upload/download integration async test

* check if net48

* silence not await warning

* try tweaking test init

* remove request close from upload

* dispose already closes, remove dup call

* remove extra upload overload

* inherit doc

* configure await

* remove excess util functions

* add cancel throws

* add cancellation tests

* missed one configure await

* use default buffer size

* private ctor

* docs

---------

Co-authored-by: Rob Hague <rob.hague00@gmail.com>
2025-05-05 23:03:10 +02:00
dependabot[bot] 16d84d0395 Bump test dependencies (#1583)
* Bump coverlet.collector from 6.0.2 to 6.0.4

Bumps [coverlet.collector](https://github.com/coverlet-coverage/coverlet) from 6.0.2 to 6.0.4.
- [Release notes](https://github.com/coverlet-coverage/coverlet/releases)
- [Commits](https://github.com/coverlet-coverage/coverlet/compare/v6.0.2...v6.0.4)

---
updated-dependencies:
- dependency-name: coverlet.collector
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* update test deps

* update test deps

* some fixes

* group dependencies

* analyzer fixes

* just group them all together

* more cleanup

* silent analyzers -> suggestion

* restore constant

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Robert Hague <rh@johnstreetcapital.com>
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
2025-02-04 21:58:59 +01:00
Rob Hague aac10fba3d Miscellaneous cleanup/throw helpers (#1491)
* PrivateKeyFile stuff

* Extract from net7 branch

* more ThrowHelper stuff
2024-09-19 07:53:05 +02:00
Wojciech Nagórski f1297dec75 Move test projects (#1212)
* Move test projects to test folder.
Move global.json to root of repo.
Update solution items in solution.

* Move test projects to test folder.
Move global.json to root of repo.
Update solution items in solution.
Update appveyor configuration/

* Attempt to have appveyor use the correct .NET SDK.

* Update .NET SDK to version 7.0.402.

* Move Data folder below Renci.SshNet.Tests.

* Make csinst less chatty.

* Move Data folder directly below test folder as it's used by multiple test projects.

* Remove CS1591 nowarn from concrete test projects as this is already defined in the Directory.Build.props that is in the test folder.

* Fix integration test after moving test projects

---------

Co-authored-by: drieseng <gert.driesen@telenet.be>
2023-10-14 22:16:11 +02:00