The integrity of file transfer is guaranteed by SSH layer in sense: all data sent over the SSH channel is received by the remote end unmodified.
There is no guarantee, that the file is not modified during the transfer in source/target storage.
In case of Upload, the file is exclusively locked for reading by
FileShare.Read constraint. In case of Download the behavior is defined by the SFTP server.
ActionOnExistingFiles.ResumeIfPossible is another case. It is designed to resume interrupted transfers. The documentation says:
Existing files are to be resumed if they are smaller than source
The behavior for
- if a file doesn't exist at target location, the whole file is transferred
- if the target file is smaller than the source file, the remaining data of the file is transferred, however there is no check for equality of source and target data
- if the target file is greater or equal than the source file, no data is transferred
If you want to check integrity, you can use the
Sftp.GetChecksum() method. But please note, it only works on servers that support the check-file extension.