No Description

Julien Laffaye b9f3ade291 Merge branch 'master' of github.com:jlaffaye/ftp 4 years ago
.github 6841a2daa0 stale bot: ignore accepted issues 4 years ago
.travis.yml dfb8646068 Fix get of golint 5 years ago
LICENSE 3a7f65cd20 Update copyright years. 11 years ago
README.md d4caf6ffca Add close on read example 4 years ago
client_test.go 827e50c0bd Add support for append (APPE) command 4 years ago
conn_test.go 827e50c0bd Add support for append (APPE) command 4 years ago
debug.go 8b7b512afb Add DialWithDebugOutput to log commands. 5 years ago
ftp.go b9f3ade291 Merge branch 'master' of github.com:jlaffaye/ftp 4 years ago
go.mod c037483193 Create Go module. 5 years ago
go.sum c037483193 Create Go module. 5 years ago
parse.go c1312a7102 Correctly parse symlink (#152) 5 years ago
parse_test.go c1312a7102 Correctly parse symlink (#152) 5 years ago
scanner.go 602886c6b8 Do not export the scanner type 7 years ago
scanner_test.go 602886c6b8 Do not export the scanner type 7 years ago
status.go ac1574d383 Add DialWithExplicitTLS 4 years ago
status_test.go 8019e67744 Add tests for StatusText 5 years ago
walker.go 37a04759dd Fixed a typo so that we are no longer ignoring an error and am now using path.Join instead of fmt.Sprintf() 4 years ago
walker_test.go 74a8c4bcbc Renamed Step func to Next() as per PR comments 5 years ago

README.md

goftp

Build Status Coverage Status Go ReportCard godoc.org

A FTP client package for Go

Install

go get -u github.com/jlaffaye/ftp

Example

c, err := ftp.Dial("ftp.example.org:21", ftp.DialWithTimeout(5*time.Second))
if err != nil {
    log.Fatal(err)
}

err = c.Login("anonymous", "anonymous")
if err != nil {
    log.Fatal(err)
}

// Do something with the FTP conn

if err := c.Quit(); err != nil {
    log.Fatal(err)
}

Store a file example

data := bytes.NewBufferString("Hello World")
err = c.Stor("test-file.txt", data)
if err != nil {
	panic(err)
}

Read a file example

r, err := c.Retr("test-file.txt")
if err != nil {
	panic(err)
}
defer r.Close()

buf, err := ioutil.ReadAll(r)
println(string(buf))