Sem descrição

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

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