Documentation
¶
Overview ¶
Package sftp handles file transfers client-side via SFTP
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewProgressBar ¶
func NewProgressBar(size int64, desc string, writer io.Writer) *progressbar.ProgressBar
NewProgressBar returns a new progress bar that writes to writer.
Types ¶
type Config ¶
type Config struct {
// ProgressWriter is a callback to return a writer for printing the progress
// (used only on the client)
ProgressWriter func(fileInfo os.FileInfo) io.Writer
// Log optionally specifies the logger
Log log.FieldLogger
// contains filtered or unexported fields
}
Config describes the settings of a file transfer
func CreateDownloadConfig ¶
CreateDownloadConfig returns a Config ready to download files
func CreateUploadConfig ¶
CreateUploadConfig returns a Config ready to upload files
type FileSystem ¶
type FileSystem interface {
// Type returns whether the filesystem is "local" or "remote"
Type() string
// Stat returns info about a file
Stat(ctx context.Context, path string) (os.FileInfo, error)
// ReadDir returns information about files contained within a directory
ReadDir(ctx context.Context, path string) ([]os.FileInfo, error)
// Open opens a file
Open(ctx context.Context, path string) (io.ReadCloser, error)
// Create creates a new file
Create(ctx context.Context, path string, mode os.FileMode) (io.WriteCloser, error)
// MkDir creates a directory
// sftp.Client.Mkdir does not take an os.FileMode, so this can't either
Mkdir(ctx context.Context, path string, mode os.FileMode) error
// Chmod sets file permissions
Chmod(ctx context.Context, path string, mode os.FileMode) error
// Chtimes sets file access and modification time
Chtimes(ctx context.Context, path string, atime, mtime time.Time) error
}
FileSystem describes file operations to be done either locally or over SFTP
Click to show internal directories.
Click to hide internal directories.