This is a creation in Article, where the information may have evolved or changed.
Package Mainimport (ftp4go "Github.com/shenshouer/ftp4go" "FMT" "OS") var (downloadfilename = "Dockertoolbo X-1.8.2a.pkg "Base_ftp_path ="/home/bob/"//BASE data PATH in FTP server) Func main () {FTPC Lient: = Ftp4go. NEWFTP (0)//1 for debugging//connect _, Err: = Ftpclient.connect ("172.8.4.101", Ftp4go. Defaultftpport, "") if err! = Nil {fmt. PRINTLN ("The Connection Failed") OS. Exit (1)} Defer Ftpclient.quit () _, Err = Ftpclient.login ("Bob", "P@ssw0rd", "" ") if err! = Nil {fmt. PRINTLN ("The Login Failed") OS. Exit (1)}//print the current working directory var CWD string cwd, err = ftpclient.pwd () if err! = Nil { Fmt. Println ("The PWD Command failed") OS. Exit (1)} FMT. Println ("The current folder is", CWD)//Get the remote file size size, err: = Ftpclient.size ("/home/bob/" +DOWNLOADF Ilename) If err! = Nil {fmt. Println ("The PWD Command failed") Os. Exit (1)} FMT. PRINTLN ("size", size)//start resume file download If Err = Ftpclient.downloadresumefile ("/home/bob/" +downloadfile Name, "/users/goyoo/ftptest/" +downloadfilename, false); Err! = nil{Panic (err)}}
copyright notice: This article for Bo Master original article, without Bo Master permission not reproduced.