ftp

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Timeout     time.Duration
	DialTimeout time.Duration
	Username    string
	Password    string
	TLSConfig   interface{} // For FTPS support
	PassiveMode bool
	DebugMode   bool
}

Config holds FTP connection configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default FTP configuration

type FTPDownloader

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

FTPDownloader handles FTP protocol downloads

func NewFTPDownloader

func NewFTPDownloader(config *Config) *FTPDownloader

NewFTPDownloader creates a new FTP downloader instance

func (*FTPDownloader) ChangeWorkingDirectory

func (f *FTPDownloader) ChangeWorkingDirectory(path string) error

ChangeWorkingDirectory changes the current working directory on the FTP server

func (*FTPDownloader) Close

func (f *FTPDownloader) Close() error

Close closes the FTP connection

func (*FTPDownloader) Connect

func (f *FTPDownloader) Connect(ctx context.Context, serverURL string) error

Connect establishes a connection to the FTP server

func (*FTPDownloader) Download

func (f *FTPDownloader) Download(ctx context.Context, urlStr string, writer io.Writer) error

Download downloads a file from FTP server and writes it to the provided writer

func (*FTPDownloader) GetCurrentDirectory

func (f *FTPDownloader) GetCurrentDirectory() (string, error)

GetCurrentDirectory returns the current working directory on the FTP server

func (*FTPDownloader) GetFileSize

func (f *FTPDownloader) GetFileSize(ctx context.Context, urlStr string) (int64, error)

GetFileSize retrieves the size of a file on the FTP server

func (*FTPDownloader) IsConnected

func (f *FTPDownloader) IsConnected() bool

IsConnected returns true if the FTP client is connected

func (*FTPDownloader) ListFiles

func (f *FTPDownloader) ListFiles(ctx context.Context, urlStr string) ([]string, error)

ListFiles lists files in a directory on the FTP server

Jump to

Keyboard shortcuts

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