Documentation
¶
Index ¶
- func DownloadDir(sftpClient *sftp.Client, remoteDir, localDir string) (int, int64, error)
- func DownloadFile(sftpClient *sftp.Client, remotePath, localPath string) (int64, error)
- func ExpandRemotePath(sftpClient *sftp.Client, remotePath string) string
- func NewSFTPClient(client *ssh.Client) (*sftp.Client, error)
- func ReadFile(sftpClient *sftp.Client, remotePath string, maxSize ...int64) ([]byte, error)
- func UploadDir(sftpClient *sftp.Client, localDir, remoteDir string) (int, int64, error)
- func UploadFile(sftpClient *sftp.Client, localPath, remotePath string, perms *fs.FileMode) (int64, error)
- func WriteFile(sftpClient *sftp.Client, remotePath string, data []byte, perms fs.FileMode) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadDir ¶
DownloadDir recursively downloads a remote directory to a local path, preserving permissions.
func DownloadFile ¶
DownloadFile downloads a remote file to a local path, preserving permissions.
func ExpandRemotePath ¶
ExpandRemotePath expands ~ and resolves relative paths on the remote server using RealPath.
func NewSFTPClient ¶
NewSFTPClient creates a new SFTP client from an SSH client.
func ReadFile ¶
ReadFile reads a remote file and returns its contents. If maxSize > 0, the file size is checked first and reading is capped with io.LimitReader.
func UploadDir ¶
UploadDir recursively uploads a local directory to a remote path, preserving permissions.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.