Documentation
¶
Index ¶
- func CreateDirIfNotExists(dir string)
- func DirIsEmpty(dirPath string) bool
- func DownloadFile(client *sftp.Client, remoteFilePath, localFilePath string) error
- func ExtractDir(embedFiles embed.FS, source string, destination string) error
- func NormalizedPath(path string) string
- func NormalizedRemotePath(remotePath string) string
- func ReadFileSafely(path string, maxSize int64) (string, error)
- func ReadRemoteFileSafely(client *sftp.Client, filePath string, maxSize int64) (string, error)
- func RemoteRemoveAll(sftpClient *sftp.Client, path string) error
- func SaveFile(client *sftp.Client, filePath, content string) error
- func UploadFile(client *sftp.Client, localFilePath, remoteFilePath string)
- type FileTransfer
- type Node
- type TransferInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadFile ¶
DownloadFile 下载远程文件到本地
func ExtractDir ¶
ExtractDir extracts a directory from the embedded filesystem.
func NormalizedRemotePath ¶
NormalizedRemotePath 归一化远程路径处理
func ReadFileSafely ¶
ReadFileSafely 安全文本文件读取方法
func ReadRemoteFileSafely ¶
ReadRemoteFileSafely 安全读取远程文本文件
func RemoteRemoveAll ¶
RemoteRemoveAll 递归删除远程目录及其中的所有内容
Types ¶
type FileTransfer ¶
type Node ¶
type Node struct {
Name string `json:"name"`
Path string `json:"path"`
ParentPath string `json:"parentPath"`
IsDir bool `json:"isDir"`
Children []*Node `json:"children,omitempty"`
Size int64 `json:"size"`
SizeInfo string `json:"sizeInfo"`
ModTime time.Time `json:"modTime"`
IsSymlink bool `json:"isSymlink"`
}
func GetFolderChild ¶
GetFolderChild 读取远程目录结构
func ReadDirTree ¶
ReadDirTree 读取目录结构 rootPath: 根路径 maxLevel: 最大遍历层级(0表示不限制)
Source Files
¶
- file.go
- file_embed.go
- sftp_file.go
- types.go
Click to show internal directories.
Click to hide internal directories.