https://github.com/smallfish/ftp
FTP Client For Go(lang)
https://github.com/smallfish/ftp
Last synced: 5 months ago
JSON representation
FTP Client For Go(lang)
- Host: GitHub
- URL: https://github.com/smallfish/ftp
- Owner: smallfish
- Created: 2011-05-09T14:32:27.000Z (about 15 years ago)
- Default Branch: master
- Last Pushed: 2016-08-01T03:53:11.000Z (almost 10 years ago)
- Last Synced: 2024-06-18T17:15:07.970Z (about 2 years ago)
- Language: Go
- Homepage:
- Size: 17.6 KB
- Stars: 87
- Watchers: 6
- Forks: 38
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
FTP client for Go(lang)
==================================
install
========
go get github.com/smallfish/ftp
example
========
```go
package main
import (
"fmt"
"github.com/smallfish/ftp"
"io/ioutil"
"os"
)
func main() {
ftp := new(ftp.FTP)
// debug default false
ftp.Debug = true
ftp.Connect("localhost", 21)
// login
ftp.Login("anonymous", "")
if ftp.Code == 530 {
fmt.Println("error: login failure")
os.Exit(-1)
}
// pwd
ftp.Pwd()
fmt.Println("code:", ftp.Code, ", message:", ftp.Message)
// make dir
ftp.Mkd("/path")
ftp.Request("TYPE I")
// stor file
b, _ := ioutil.ReadFile("/path/a.txt")
ftp.Stor("/path/a.txt", b)
ftp.Quit()
}
```