Skip to content
This repository has been archived by the owner on Mar 11, 2023. It is now read-only.
/ goftp Public archive

Goftp is a simple FTP library written in golang.

License

Notifications You must be signed in to change notification settings

martinr92/goftp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goftp

Build Status GoDoc Go Report Card codecov

Goftp is a simple FTP library written in golang. The implementation is based on the RFC 959 - FILE TRANSFER PROTOCOL (FTP)

Features

  • active and passive data connection mode

Usage

Download the package and import it into your project.

import ftp "github.com/martinr92/goftp"

Connect to the remote server.

ftpClient, err := ftp.NewFtp("host.local:51000")
if err != nil {
    panic(err)
}
defer ftpClient.Close()

By default, the client uses a passive data connection for file transfer. If you want to use a active connection, just set the following:

ftpClient.ActiveMode = true
ftpClient.ActiveModeIPv4 = "1.2.3.4"

Send user credentials.

if err = ftpClient.Login("username", "password"); err != nil {
    panic(err)
}

Change the working directory.

if err = ftpClient.OpenDirectory("/some/folder/"); err != nil {
    panic(err)
}

Upload a file.

if err = ftpClient.Upload("/local/path/file.txt", "file.txt"); err != nil {
    panic(err)
}

About

Goftp is a simple FTP library written in golang.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages