🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

github.com/smallfish/ftp

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/smallfish/ftp

v0.0.0-20160801035311-6d094f003ac5
Source
Go
Version published
Created
Source

FTP client for Go(lang)

install

go get github.com/smallfish/ftp

example

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

FAQs

Package last updated on 01 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts