Skip to content

Cancalletion token and download callback in the SftpClient DownloadFileAsync / BeginDownloadFile? #1765

Closed

Description

@synek317

Both methods call InternalDownloadFile, which accepts both a download callback and a cancellation token.

However:

  • DownloadFileAsync does not support a download callback.
  • BeginDownloadFile does not support a cancellation token.

Is there a specific reason for this design?

I'm struggling to implement a sequential download of multiple files with a global timeout (for example, a timeout that applies to the entire download process across all files) along with progress reporting. With the current API, this seems unnecessarily challenging.

Please note that I'm not a very advanced user of async in c#. If the above does not make sense, I would appreciate advice on how to do it better.

Activity

  1. changed the title [-]Cancalletion token and download callback in DownloadFileAsync / BeginDownloadFile?[/-] [+]Cancalletion token and download callback in the SftpClient DownloadFileAsync / BeginDownloadFile?[/+] on Feb 5, 2026
  2. added a commit that references this issue on Mar 14, 2026
    54026bb
  3. mus65 commented on Mar 14, 2026

    @mus65
    Contributor

    DownloadFileAsync does not support a download callback.

    I assume this is just an oversight, opened #1771 .

    The Begin* APIs really shouldn't be used anymore.

  4. added a commit that references this issue on Mar 16, 2026
    0ff2c50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions