sftp

package
v2.0.14 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	SSHClient  *ssh.Client
	SFTPClient *sftp.Client
}

Client Stored Client val

func (*Client) Chmod

func (client *Client) Chmod(path string, mode os.FileMode) error

Chmod ..

func (*Client) Chown

func (client *Client) Chown(path string, uid, gid int) error

Chown changes the user and group owners of the named file.

func (*Client) Close

func (client *Client) Close() (errors []error)

Close Connection ALL Connection Close

func (*Client) DownFile

func (client *Client) DownFile(serverPath, destPath string) (int64, error)

DownFile 下载文件到本地

func (*Client) DownFileWithProgress

func (client *Client) DownFileWithProgress(serverPath, destPath string, transferred *int64, total *int64) (int64, error)

DownFileWithProgress [Experimental] Get with Display Processing Bytes

func (*Client) GetRecursively

func (client *Client) GetRecursively(remotePath, localPath string) error

GetRecursively is Recursively Download entire directories

func (*Client) Getwd

func (client *Client) Getwd() (string, error)

Getwd returns the current working directory of the server. Operations involving relative paths will be based at this location.

func (*Client) Mkdir

func (client *Client) Mkdir(path string) error

Mkdir creates the specified directory. An error will be returned if a file or directory with the specified path already exists, or if the directory's parent folder does not exist (the method cannot create complete paths).

func (*Client) MkdirAll

func (client *Client) MkdirAll(path string) error

MkdirAll creates a directory named path, along with any necessary parents, and returns nil, or else returns an error. If path is already a directory, MkdirAll does nothing and returns nil. If path contains a regular file, an error is returned

func (*Client) PosixRename

func (client *Client) PosixRename(oldname, newname string) error

PosixRename renames a file using the posix-rename@openssh.com extension which will replace newname if it already exists.

func (*Client) PutRecursively

func (client *Client) PutRecursively(localPath string, remotePath string) error

PutRecursively is Recursively Upload entire directories

func (*Client) Quit

func (client *Client) Quit() (errors []error)

Quit alias Close()

func (*Client) Remove

func (client *Client) Remove(path string) error

Remove removes the specified file or directory. An error will be returned if no file or directory with the specified path exists, or if the specified directory is not empty.

func (*Client) RemoveDirectory

func (client *Client) RemoveDirectory(path string) error

RemoveDirectory removes a directory path.

func (*Client) Rename

func (client *Client) Rename(oldname, newname string) error

Rename renames a file.

func (*Client) UploadFile

func (client *Client) UploadFile(localFilepath string, remoteFilepath string) (int64, error)

UploadFile is Single File Upload

func (*Client) UploadFileWithProgress

func (client *Client) UploadFileWithProgress(localFilepath string, remoteFilepath string, transferred *int64, total *int64) (int64, error)

UploadFileWithProgress [Experimental] Put with Display Processing Bytes

type Config

type Config struct {
	Host     string
	Port     string
	User     string
	Password string
	Timeout  time.Duration
}

Config 配置

func (*Config) New

func (config *Config) New() (*Client, error)

New 新建连接

type IOReaderProgress

type IOReaderProgress struct {
	io.Reader
	TransferredBytes *int64 // Total of bytes transferred
}

IOReaderProgress forwards the Read() call Addging transferredBytes

func (*IOReaderProgress) Read

func (iorp *IOReaderProgress) Read(p []byte) (int, error)

Jump to

Keyboard shortcuts

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