<PackageReference Include="SSH.NET" Version="2025.1.0" />

ISftpSession

Represents an SFTP session.
uint ProtocolVersion { get; }

Gets the SFTP protocol version.

string WorkingDirectory { get; }

Gets the remote working directory.

uint CalculateOptimalReadLength(uint bufferSize)

Calculates the optimal size of the buffer to read data from the channel.

uint CalculateOptimalWriteLength(uint bufferSize, byte[] handle)

Calculates the optimal size of the buffer to write data on the channel.

void ChangeDirectory(string path)

Changes the current working directory to the specified path.

Task ChangeDirectoryAsync(string path, CancellationToken cancellationToken)

Asynchronously requests to change the current working directory to the specified path.

string GetCanonicalPath(string path)

Resolves a given path into an absolute path on the server.

Task<string> GetCanonicalPathAsync(string path, CancellationToken cancellationToken)

Asynchronously resolves a given path into an absolute path on the server.

void RequestClose(byte[] handle)

Performs a SSH_FXP_CLOSE request.

Task RequestCloseAsync(byte[] handle, CancellationToken cancellationToken)

Performs a SSH_FXP_CLOSE request.

void RequestFSetStat(byte[] handle, SftpFileAttributes attributes)

Performs SSH_FXP_FSETSTAT request.

Asynchronously performs a SSH_FXP_FSTAT request.

Task<SftpFileAttributes> RequestFStatAsync(byte[] handle, CancellationToken cancellationToken)

Asynchronously performs a SSH_FXP_FSTAT request.

Performs SSH_FXP_LSTAT request.

Asynchronously performs SSH_FXP_LSTAT request.

void RequestMkDir(string path)

Performs SSH_FXP_MKDIR request.

Task RequestMkDirAsync(string path, CancellationToken cancellationToken)

Asynchronously performs SSH_FXP_MKDIR request.

byte[] RequestOpen(string path, Flags flags)

Performs a SSH_FXP_OPEN request.

Task<byte[]> RequestOpenAsync(string path, Flags flags, CancellationToken cancellationToken)

Asynchronously performs a SSH_FXP_OPEN request.

byte[] RequestOpenDir(string path)

Performs a SSH_FXP_OPENDIR request.

Task<byte[]> RequestOpenDirAsync(string path, CancellationToken cancellationToken)

Asynchronously performs a SSH_FXP_OPENDIR request.

void RequestPosixRename(string oldPath, string newPath)

Performs posix-rename@openssh.com extended request.

byte[] RequestRead(byte[] handle, ulong offset, uint length)

Performs SSH_FXP_READ request.

Task<byte[]> RequestReadAsync(byte[] handle, ulong offset, uint length, CancellationToken cancellationToken)

Asynchronously performs a SSH_FXP_READ request.

Performs a SSH_FXP_READDIR request.

Task<KeyValuePair<string, SftpFileAttributes>[]> RequestReadDirAsync(byte[] handle, CancellationToken cancellationToken)

Performs a SSH_FXP_READDIR request.

void RequestRemove(string path)

Performs a SSH_FXP_REMOVE request.

Task RequestRemoveAsync(string path, CancellationToken cancellationToken)

Asynchronously performs a SSH_FXP_REMOVE request.

void RequestRename(string oldPath, string newPath)

Performs a SSH_FXP_RENAME request.

Task RequestRenameAsync(string oldPath, string newPath, CancellationToken cancellationToken)

Asynchronously performs a SSH_FXP_RENAME request.

void RequestRmDir(string path)

Performs SSH_FXP_RMDIR request.

Task RequestRmDirAsync(string path, CancellationToken cancellationToken)

Asynchronously performs an SSH_FXP_RMDIR request.

void RequestSetStat(string path, SftpFileAttributes attributes)

Performs SSH_FXP_SETSTAT request.

Performs SSH_FXP_STAT request.

Performs a statvfs@openssh.com extended request.

Asynchronously performs a statvfs@openssh.com extended request.

void RequestSymLink(string linkpath, string targetpath)

Performs SSH_FXP_SYMLINK request.

void RequestWrite(byte[] handle, ulong serverOffset, byte[] data, int offset, int length, AutoResetEvent wait, Action<SftpStatusResponse> writeCompleted = null)

Performs SSH_FXP_WRITE request.

Task RequestWriteAsync(byte[] handle, ulong serverOffset, byte[] data, int offset, int length, CancellationToken cancellationToken)

Asynchronouly performs a SSH_FXP_WRITE request.