Example #1
0
func main() {
	log.SetFlags(log.Flags() | log.Lshortfile)

	ftp, err := goftp.Dial("172.8.4.101:21")
	if err != nil {
		log.Fatal(err)
	}

	fileInfo, err := ftp.Stat("/home/bob/DockerToolbox-1.8.2a.pkg")
	if err != nil {
		log.Fatal(err)
	}

	log.Println(fileInfo)
}
Example #2
0
func downloadSecurities() (*bytes.Buffer, error) {
	buffer := new(bytes.Buffer)

	client, err := goftp.Dial(nasdaqFTP)
	if err != nil {
		log.Fatalf("Error connecting to NASDAQ FTP: ", err)
		return nil, err
	}

	err = client.Retrieve(nasdaqFile, buffer)
	if err != nil {
		log.Fatalf("Error retrieving CSV file: ", err)
		return nil, err
	}

	return buffer, nil
}