Ei kuvausta

Julien Laffaye b9f3ade291 Merge branch 'master' of github.com:jlaffaye/ftp 4 vuotta sitten
.github 6841a2daa0 stale bot: ignore accepted issues 4 vuotta sitten
.travis.yml dfb8646068 Fix get of golint 5 vuotta sitten
LICENSE 3a7f65cd20 Update copyright years. 12 vuotta sitten
README.md d4caf6ffca Add close on read example 4 vuotta sitten
client_test.go 827e50c0bd Add support for append (APPE) command 4 vuotta sitten
conn_test.go 827e50c0bd Add support for append (APPE) command 4 vuotta sitten
debug.go 8b7b512afb Add DialWithDebugOutput to log commands. 5 vuotta sitten
ftp.go b9f3ade291 Merge branch 'master' of github.com:jlaffaye/ftp 4 vuotta sitten
go.mod c037483193 Create Go module. 5 vuotta sitten
go.sum c037483193 Create Go module. 5 vuotta sitten
parse.go c1312a7102 Correctly parse symlink (#152) 5 vuotta sitten
parse_test.go c1312a7102 Correctly parse symlink (#152) 5 vuotta sitten
scanner.go 602886c6b8 Do not export the scanner type 7 vuotta sitten
scanner_test.go 602886c6b8 Do not export the scanner type 7 vuotta sitten
status.go ac1574d383 Add DialWithExplicitTLS 4 vuotta sitten
status_test.go 8019e67744 Add tests for StatusText 5 vuotta sitten
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 vuotta sitten
walker_test.go 74a8c4bcbc Renamed Step func to Next() as per PR comments 5 vuotta sitten

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