sftpclient

package
v0.0.0-...-d1207c5 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FolderMapping

type FolderMapping struct {
	Local  string
	Remote string
}

FolderMapping maps local to remote folders

type Response

type Response struct {
	File string
	Err  error
}

Response is a reponse which contains a filename or error

type SFTPClient

type SFTPClient struct {
	// contains filtered or unexported fields
}

SFTPClient is a proxy to sftp.Client

func New

func New(hostname string, port int, username string, password string) (client *SFTPClient, err error)

New SFTP Connection

func (*SFTPClient) BackupFiles

func (c *SFTPClient) BackupFiles(destination string, files []string, response chan<- Response)

BackupFiles saves remote files to a local tar.gz file

func (*SFTPClient) Close

func (c *SFTPClient) Close() error

Close the SFTP session

func (*SFTPClient) CreateDir

func (c *SFTPClient) CreateDir(remoteFolderPath string) error

CreateDir creates a folder on remote location

func (*SFTPClient) CreateDirHierarchy

func (c *SFTPClient) CreateDirHierarchy(remoteFolderPath string) error

CreateDirHierarchy creates a folder hierarchy on remote location

func (*SFTPClient) FindAllRemoteFiles

func (c *SFTPClient) FindAllRemoteFiles(paths []string) ([]string, error)

FindAllRemoteFiles enumerates all remote files in multiple directories and their descendents

func (*SFTPClient) FindRemoteFiles

func (c *SFTPClient) FindRemoteFiles(path string) func() (r <-chan Response)

FindRemoteFiles enumerates files in a remote directory

func (*SFTPClient) GetFile

func (c *SFTPClient) GetFile(localFilename string, remoteFilename string) error

GetFile retreives a file from remote location

func (*SFTPClient) GetFiles

func (c *SFTPClient) GetFiles(folders []FolderMapping, response chan<- Response, count chan<- int, done chan<- bool)

GetFiles retreives all files from a remote location

func (*SFTPClient) PutFile

func (c *SFTPClient) PutFile(remoteFileName string, localFileName string) error

PutFile uploads a local file to remote location

func (*SFTPClient) PutFiles

func (c *SFTPClient) PutFiles(folders []FolderMapping, response chan<- Response, count chan<- int, done chan<- bool)

PutFiles uploads all local files to remote location

func (*SFTPClient) TarFile

func (c *SFTPClient) TarFile(w *tar.Writer, filename string) error

TarFile adds a remote file into a tar archive

Jump to

Keyboard shortcuts

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