Documentation
¶
Overview ¶
Package sftpx
@author: xwc1125
Package sftpx ¶
@author: xwc1125
Index ¶
- type FileInfo
- type FileInfos
- type Mode
- type OptParams
- type SFTP
- func (s *SFTP) Close() error
- func (s *SFTP) DownloadDir(fullPath string) ([]byte, error)
- func (s *SFTP) DownloadFile(fullPath string) ([]byte, error)
- func (s *SFTP) HandleOpt(params OptParams) (interface{}, error)
- func (s *SFTP) Mkdir(dirPath string) error
- func (s *SFTP) ReadDir(dirPath string) (*FileInfos, error)
- func (s *SFTP) Remove(fullPath string, isDir bool) error
- func (s *SFTP) Rename(o, n string) error
- func (s *SFTP) ServeWs(wsConn *websocket.Conn) error
- func (s *SFTP) SftpClient() *sftp.Client
- func (s *SFTP) Upload(desDir string, fileName string, srcFile multipart.File) error
- type SftpApi
- func (ap SftpApi) SftpDownloadDir(c contextx.Context, sshClient *ssh.Client)
- func (ap SftpApi) SftpDownloadFile(c contextx.Context, sshClient *ssh.Client)
- func (ap SftpApi) SftpFileInfos(c contextx.Context, sshClient *ssh.Client)
- func (ap SftpApi) SftpMkdir(c contextx.Context, sshClient *ssh.Client)
- func (ap SftpApi) SftpRm(c contextx.Context, sshClient *ssh.Client)
- func (ap SftpApi) SftpUpload(c contextx.Context, sshClient *ssh.Client)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileInfo ¶
type FileInfo struct {
Name string `json:"name"` // 文件名称
Path string `json:"path"` // 路径
Size int64 `json:"size"` // 文件大小
Mode string `json:"mode"` // 权限
ModTime string `json:"modTime"` // 修改时间
IsDir bool `json:"isDir"` // 是否是文件夹
}
FileInfo 文件信息
type OptParams ¶
type OptParams struct {
Mode Mode `json:"mode"` // 操作类型
Path string `json:"path,omitempty"` // 路径
IsDir bool `json:"is_dir,omitempty"` // 路径是否为文件夹
OldName string `json:"old_name"` // 旧文件名
NewName string `json:"new_name"` // 新文件名
FileName string `json:"file_name,omitempty"` // 文件上传时的文件名
File multipart.File `json:"file,omitempty"` // 文件上传时的文件内容
}
type SFTP ¶
type SFTP struct {
// contains filtered or unexported fields
}
SFTP sftp对象
func (*SFTP) DownloadDir ¶
DownloadDir 下载文件/夹
func (*SFTP) DownloadFile ¶
DownloadFile 下载文件
func (*SFTP) SftpClient ¶
type SftpApi ¶
type SftpApi struct {
}
func (SftpApi) SftpDownloadDir ¶
SftpDownloadDir 下载文件夹
func (SftpApi) SftpDownloadFile ¶
SftpDownloadFile 下载文件
func (SftpApi) SftpFileInfos ¶
SftpFileInfos 文件夹列表
Click to show internal directories.
Click to hide internal directories.