Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrHashMismatch = errors.New("hash mismatch")
ErrHashMismatch reports that downloaded content did not hash to the expected value; the local file has not been replaced in that case.
Functions ¶
func DownloadVerified ¶ added in v1.11.0
func DownloadVerified(t Transport, remoteRelPath, localPath, wantHash string, progress io.Writer) error
DownloadVerified downloads remoteRelPath and, when wantHash is non-empty, verifies the content hash *before* the file replaces localPath. On mismatch the local file is left untouched and ErrHashMismatch is returned. progress, when non-nil, is forwarded to the underlying Download (F12).
Types ¶
type RemoteInfo ¶ added in v1.11.0
RemoteInfo is the actual server-side state of a path (as opposed to what the remote .ft/index.json claims). Mtime is zero when the server cannot report it (some FTP servers lack MDTM).
type Transport ¶
type Transport interface {
Connect() error
Close() error
Upload(localPath, remoteRelPath string, progress io.Writer) error
Download(remoteRelPath, localPath string, progress io.Writer) error
List(remoteDir string) ([]string, error)
ListDir(remoteDir string) ([]DirEntry, error)
Delete(remoteRelPath string) error
Stat(remoteRelPath string) (RemoteInfo, error)
FileExists(remoteRelPath string) (bool, int64, error)
ReadFile(remoteRelPath string) ([]byte, error)
WriteFile(remoteRelPath string, data []byte) error
EnsureDir(remoteRelPath string) error
}
Click to show internal directories.
Click to hide internal directories.