ftp

package
v4.1.9 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: AGPL-3.0 Imports: 27 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStagePathConflict = errors.New("upload path conflict")
	ErrStageMoved        = errors.New("uploading file has been moved")
)

Functions

func HandleSIZE

func HandleSIZE(param string, client ftpserver.ClientDriver) (int, string)

func InitStage added in v4.1.4

func InitStage()

func List

func List(ctx context.Context, path string) ([]os.FileInfo, error)

func ListStage added in v4.1.4

func ListStage(path string) map[string]model.Obj

func MakeStage added in v4.1.4

func MakeStage(ctx context.Context, buffer *os.File, size int64, path string, mv func(string)) (*UploadingFile, *BorrowedFile, error)

func Mkdir

func Mkdir(ctx context.Context, path string) error

func MoveStage added in v4.1.4

func MoveStage(from, to string) error

func Remove

func Remove(ctx context.Context, path string) error

func RemoveStage added in v4.1.4

func RemoveStage(path string) error

func Rename

func Rename(ctx context.Context, oldPath, newPath string) error

func Stat

func Stat(ctx context.Context, path string) (os.FileInfo, error)

func StatStage added in v4.1.4

func StatStage(path string) (os.FileInfo, error)

Types

type AferoAdapter

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

func NewAferoAdapter

func NewAferoAdapter(ctx context.Context) *AferoAdapter

func (*AferoAdapter) Chmod

func (a *AferoAdapter) Chmod(_ string, _ os.FileMode) error

func (*AferoAdapter) Chown

func (a *AferoAdapter) Chown(_ string, _, _ int) error

func (*AferoAdapter) Chtimes

func (a *AferoAdapter) Chtimes(_ string, _ time.Time, _ time.Time) error

func (*AferoAdapter) Create

func (a *AferoAdapter) Create(_ string) (afero.File, error)

func (*AferoAdapter) GetHandle

func (a *AferoAdapter) GetHandle(name string, flags int, offset int64) (ftpserver.FileTransfer, error)

func (*AferoAdapter) Mkdir

func (a *AferoAdapter) Mkdir(name string, _ os.FileMode) error

func (*AferoAdapter) MkdirAll

func (a *AferoAdapter) MkdirAll(path string, perm os.FileMode) error

func (*AferoAdapter) Name

func (a *AferoAdapter) Name() string

func (*AferoAdapter) Open

func (a *AferoAdapter) Open(_ string) (afero.File, error)

func (*AferoAdapter) OpenFile

func (a *AferoAdapter) OpenFile(_ string, _ int, _ os.FileMode) (afero.File, error)

func (*AferoAdapter) ReadDir

func (a *AferoAdapter) ReadDir(name string) ([]os.FileInfo, error)

func (*AferoAdapter) Remove

func (a *AferoAdapter) Remove(name string) error

func (*AferoAdapter) RemoveAll

func (a *AferoAdapter) RemoveAll(path string) error

func (*AferoAdapter) Rename

func (a *AferoAdapter) Rename(oldName, newName string) error

func (*AferoAdapter) SetNextFileSize

func (a *AferoAdapter) SetNextFileSize(size int64)

func (*AferoAdapter) Site

func (a *AferoAdapter) Site(param string) *ftpserver.AnswerCommand

func (*AferoAdapter) Stat

func (a *AferoAdapter) Stat(name string) (os.FileInfo, error)

type BorrowedFile added in v4.1.4

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

func Borrow added in v4.1.4

func Borrow(ctx context.Context, path string) (*BorrowedFile, error)

func (*BorrowedFile) Close added in v4.1.4

func (f *BorrowedFile) Close() error

func (*BorrowedFile) Read added in v4.1.4

func (f *BorrowedFile) Read(p []byte) (n int, err error)

func (*BorrowedFile) ReadAt added in v4.1.4

func (f *BorrowedFile) ReadAt(p []byte, off int64) (n int, err error)

func (*BorrowedFile) Seek added in v4.1.4

func (f *BorrowedFile) Seek(offset int64, whence int) (int64, error)

func (*BorrowedFile) Write added in v4.1.4

func (f *BorrowedFile) Write(_ []byte) (n int, err error)

type FileDownloadProxy

type FileDownloadProxy struct {
	model.File
	io.Closer
	// contains filtered or unexported fields
}

func OpenDownload

func OpenDownload(ctx context.Context, reqPath string, offset int64) (*FileDownloadProxy, error)

func (*FileDownloadProxy) Read

func (f *FileDownloadProxy) Read(p []byte) (n int, err error)

func (*FileDownloadProxy) ReadAt added in v4.0.8

func (f *FileDownloadProxy) ReadAt(p []byte, off int64) (n int, err error)

func (*FileDownloadProxy) Write

func (f *FileDownloadProxy) Write(p []byte) (n int, err error)

type FileUploadProxy

type FileUploadProxy struct {
	ftpserver.FileTransfer
	// contains filtered or unexported fields
}

func OpenUpload

func OpenUpload(ctx context.Context, path string, trunc bool) (*FileUploadProxy, error)

func (*FileUploadProxy) Close

func (f *FileUploadProxy) Close() error

func (*FileUploadProxy) Read

func (f *FileUploadProxy) Read(p []byte) (n int, err error)

func (*FileUploadProxy) Seek

func (f *FileUploadProxy) Seek(offset int64, whence int) (int64, error)

func (*FileUploadProxy) Write

func (f *FileUploadProxy) Write(p []byte) (n int, err error)

type FileUploadWithLengthProxy

type FileUploadWithLengthProxy struct {
	ftpserver.FileTransfer
	// contains filtered or unexported fields
}

func OpenUploadWithLength

func OpenUploadWithLength(ctx context.Context, path string, trunc bool, length int64) (*FileUploadWithLengthProxy, error)

func (*FileUploadWithLengthProxy) Close

func (f *FileUploadWithLengthProxy) Close() error

func (*FileUploadWithLengthProxy) Read

func (f *FileUploadWithLengthProxy) Read(p []byte) (n int, err error)

func (*FileUploadWithLengthProxy) Seek

func (f *FileUploadWithLengthProxy) Seek(offset int64, whence int) (int64, error)

func (*FileUploadWithLengthProxy) Write

func (f *FileUploadWithLengthProxy) Write(p []byte) (n int, err error)

type OsFileInfoAdapter

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

func (*OsFileInfoAdapter) IsDir

func (o *OsFileInfoAdapter) IsDir() bool

func (*OsFileInfoAdapter) ModTime

func (o *OsFileInfoAdapter) ModTime() time.Time

func (*OsFileInfoAdapter) Mode

func (o *OsFileInfoAdapter) Mode() fs2.FileMode

func (*OsFileInfoAdapter) Name

func (o *OsFileInfoAdapter) Name() string

func (*OsFileInfoAdapter) Size

func (o *OsFileInfoAdapter) Size() int64

func (*OsFileInfoAdapter) Sys

func (o *OsFileInfoAdapter) Sys() any

type UploadingFile added in v4.1.4

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

func (*UploadingFile) SetRemoveCallback added in v4.1.4

func (u *UploadingFile) SetRemoveCallback(rm func())

Jump to

Keyboard shortcuts

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