sftp

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2021 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSftpClient

func NewSftpClient(mc *common.Machine) (*sftp.Client, error)

func SftpCat

func SftpCat(fullPath string, mc *common.Machine)

func SftpCopy

func SftpCopy(srcFullPath, destFullPath string, mc *common.Machine) error

func SftpCreateDir

func SftpCreateDir(fullPath string, mc *common.Machine) error

func SftpCreateFile

func SftpCreateFile(fullPath string, mc *common.Machine) error

func SftpDownloadLocal

func SftpDownloadLocal(fullPath string, mc *common.Machine)

func SftpFetchFile

func SftpFetchFile(fullPath string, mc *common.Machine) (*sftp.File, os.FileInfo, error)

func SftpFetchFileToResponse

func SftpFetchFileToResponse(fullPath string, mc *common.Machine, w http.ResponseWriter, r *http.Request) error

func SftpFetchToArchive

func SftpFetchToArchive(dirPath string, filenames []string, ar archiver.Writer, extension string, mc *common.Machine) error

func SftpLs

func SftpLs(dirPath string, mc *common.Machine) ([]*Ls, *LsMeta, error)

func SftpRename

func SftpRename(oldFullPath, newFullPath string, mc *common.Machine) error

func SftpRmDir

func SftpRmDir(fullPath string, mc *common.Machine) error

func SftpRmFile

func SftpRmFile(fullPath string, mc *common.Machine) error

func SftpUpFile

func SftpUpFile(file *os.File, desDir string, mc *common.Machine) error

func SftpUpFileHeader

func SftpUpFileHeader(header *multipart.FileHeader, desDir string, mc *common.Machine)

func SftpUpRequest

func SftpUpRequest(desDir string, r *http.Request, w http.ResponseWriter, mc *common.Machine) error

Types

type Ls

type Ls struct {
	Name  string    `json:"name"`
	Path  string    `json:"path"` // including Name
	Size  int64     `json:"size"`
	Time  time.Time `json:"time"`
	Mod   string    `json:"mod"`
	IsDir bool      `json:"is_dir"`
	Index int       `json:"index"`
}

func SftpStat

func SftpStat(dirPath string, mc *common.Machine) (*Ls, error)

type LsMeta

type LsMeta struct {
	DirPath   string `json:"dir_path"`
	FileCount int    `json:"file_count"`
	DirCount  int    `json:"dir_count"`

	Name  string    `json:"name"`
	Size  int64     `json:"size"`
	Time  time.Time `json:"time"`
	Mod   string    `json:"mod"`
	IsDir bool      `json:"is_dir"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL