sftp

package
v0.0.0-...-62529e4 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2025 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 {
	// 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) Download

func (c *Client) Download(filePath string) ([]byte, error)

Download returns a remote file.

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(filePath string, fileContent []byte) error

Upload writes a file to a remote location.

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
⌂ 换网址