ftp

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package ftp provides functions for interacting with a FTP server.

Index

Constants

View Source
const (
	DefaultPort    = 21
	DefaultTimeout = 5 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

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

Reader implements the io.ReadCloser interface to enabling reading a remote file on a FTP server and closing the underlying connections.

func Fetch

func Fetch(uri string) (*Reader, error)

Fetch returns a Reader for an object for given FTP address. ReadFTPFile returns the Reader and error, if any.

ReadFTPFile returns an error if the address cannot be dialed, the userinfo cannot be parsed, the user and password are invalid, or the file cannot be retrieved.

func NewReader

func NewReader(response *ftp.Response, server *ftp.ServerConn) *Reader

NewReader creates a new Reader for reading from a FTP server.

func NewReaderWithDeadline

func NewReaderWithDeadline(response *ftp.Response, server *ftp.ServerConn, deadline time.Time) (*Reader, error)

NewReaderWithDeadline creates a new Reader for reading from a FTP server with a set deadline.

func (*Reader) Close

func (r *Reader) Close() error

Close closes the reader and quits the underlying connection.

func (*Reader) Read

func (r *Reader) Read(p []byte) (int, error)

Read implements the io.Reader interface.

func (*Reader) SetDeadline

func (r *Reader) SetDeadline(t time.Time) error

SetDeadline sets the deadlines associated with the connection.

Jump to

Keyboard shortcuts

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