Skip to content

Nuntawut/ftp.go

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

FTP client for Google Go language

example:

import "fmt"
import "os"
import "io/ioutil"
import "./ftp"

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()
}

About

FTP Client For Go Language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published