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

ISftpSession

Represents an SFTP session.
using Renci.SshNet.Sftp.Responses; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace Renci.SshNet.Sftp { internal interface ISftpSession : ISubsystemSession, IDisposable { uint ProtocolVersion { get; } string WorkingDirectory { get; } void ChangeDirectory(string path); Task ChangeDirectoryAsync(string path, CancellationToken cancellationToken); string GetCanonicalPath(string path); Task<string> GetCanonicalPathAsync(string path, CancellationToken cancellationToken); SftpFileAttributes RequestFStat(byte[] handle); Task<SftpFileAttributes> RequestFStatAsync(byte[] handle, CancellationToken cancellationToken); SftpFileAttributes RequestStat(string path); SftpFileAttributes RequestLStat(string path); Task<SftpFileAttributes> RequestLStatAsync(string path, CancellationToken cancellationToken); void RequestMkDir(string path); Task RequestMkDirAsync(string path, CancellationToken cancellationToken); byte[] RequestOpen(string path, Flags flags); Task<byte[]> RequestOpenAsync(string path, Flags flags, CancellationToken cancellationToken); byte[] RequestOpenDir(string path); Task<byte[]> RequestOpenDirAsync(string path, CancellationToken cancellationToken); void RequestPosixRename(string oldPath, string newPath); byte[] RequestRead(byte[] handle, ulong offset, uint length); Task<byte[]> RequestReadAsync(byte[] handle, ulong offset, uint length, CancellationToken cancellationToken); KeyValuePair<string, SftpFileAttributes>[] RequestReadDir(byte[] handle); Task<KeyValuePair<string, SftpFileAttributes>[]> RequestReadDirAsync(byte[] handle, CancellationToken cancellationToken); void RequestRemove(string path); Task RequestRemoveAsync(string path, CancellationToken cancellationToken); void RequestRename(string oldPath, string newPath); Task RequestRenameAsync(string oldPath, string newPath, CancellationToken cancellationToken); void RequestRmDir(string path); Task RequestRmDirAsync(string path, CancellationToken cancellationToken); void RequestSetStat(string path, SftpFileAttributes attributes); SftpFileSystemInformation RequestStatVfs(string path); Task<SftpFileSystemInformation> RequestStatVfsAsync(string path, CancellationToken cancellationToken); void RequestSymLink(string linkpath, string targetpath); void RequestFSetStat(byte[] handle, SftpFileAttributes attributes); void RequestWrite(byte[] handle, ulong serverOffset, byte[] data, int offset, int length, AutoResetEvent wait, Action<SftpStatusResponse> writeCompleted = null); Task RequestWriteAsync(byte[] handle, ulong serverOffset, byte[] data, int offset, int length, CancellationToken cancellationToken); void RequestClose(byte[] handle); Task RequestCloseAsync(byte[] handle, CancellationToken cancellationToken); uint CalculateOptimalReadLength(uint bufferSize); uint CalculateOptimalWriteLength(uint bufferSize, byte[] handle); } }