FTP Client For Go Language
Go
Pull request Compare This branch is 2 commits ahead, 10 commits behind smallfish:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README
ftp.go

README

FTP client for Google Go language

example:

import "fmt"
import "os"
import "io/ioutil"
import "github.com/victorcoder/ftp.go"

func main() {
    // new ftp
    ftp := new(ftp.FTP)
    // set debug, default false
    ftp.Debug = true
    // connect
    ftp.Connect("10.0.0.0", 20)
    // login
    ftp.Login("smallfish", "****")
    // login failure
    if ftp.Code == 530 {
        fmt.Println("error: login failure")
        os.Exit(-1)
    }
    // pwd
    ftp.Pwd()
    fmt.Println("code:", ftp.Code, ", message:", ftp.Message)
    // mkdir new dir
    ftp.Mkd("/smallfish")
    // stor new file
    ftp.Request("TYPE I")
    b, _ := ioutil.ReadFile("/path/a.txt")
    ftp.Stor("/smallfish/a.txt", b)
    // quit
    ftp.Quit()
}