mysftp

package
v0.0.0-...-a4bd870 Latest Latest
Warning

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

Go to latest
Published: May 15, 2022 License: MIT Imports: 7 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 {
	SftpClient *sftp.Client
	// contains filtered or unexported fields
}

Client provides basic functionality to interact with a SFTP server.

func New

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

New initialises SSH and SFTP clients and returns Client type to use.

func (*Client) Close

func (c *Client) Close()

Close closes open connections.

func (*Client) Create

func (c *Client) Create(filePath string) (io.ReadWriteCloser, error)

Create creates a remote/destination file for I/O.

func (*Client) Download

func (c *Client) Download(filePath string) (io.ReadCloser, error)

Download returns remote/destination file for reading.

func (*Client) Info

func (c *Client) Info(filePath string) (os.FileInfo, error)

Info gets the details of a file. If the file was not found, an error is returned.

func (*Client) Upload

func (c *Client) Upload(source io.Reader, destination io.Writer, size int) error

Upload writes local/source file data streams to remote/destination file.

type Config

type Config struct {
	Username     string
	Password     string
	PrivateKey   string
	Server       string
	KeyExchanges []string

	Timeout time.Duration
}

Config represents SSH connection parameters.

Jump to

Keyboard shortcuts

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