download

package
v0.0.0-...-227a521 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FTPDefaultPort     = "21"
	FTPDefaultUsername = "anonymous"
	FTPDefaultPassword = "anonymous"
)

FTP 默认参数

View Source
var (
	URL       string
	AccessKey string
	SecretKey string
	SSL       bool
)

s3参数

Functions

func EncodeJSON

func EncodeJSON(data interface{}) ([]byte, error)

EncodeJSON 结构体转Json

func S3Download

func S3Download(filePath, bucket, fileKey string) (string, error)

S3Download s3下载文件

func SendRequest

func SendRequest(method, baseURL, path string, body interface{}, header map[string]string, cookie map[string]string, RegistryUserName, RegistryPwd string) ([]byte, int, error)

SendRequest 发送请求

func SftpCreate

func SftpCreate(user string, passwd string, host string, port string) (*sftp.Client, error)

SftpCreate 创建sftp 客户端

func SftpReadAll

func SftpReadAll(user string, passwd string, host string, port string, sPath string) ([]byte, error)

SftpReadAll 获取sftp sPath下所有文件列表

Types

type FTP

type FTP struct {
}

FTP 结构体

func (*FTP) Download

func (f *FTP) Download(urlStr, host, port, user, password string, filePath, targetPath string) (string, error)

Download FTP 下载

type HTTP

type HTTP struct {
}

HTTP 结构体

func (*HTTP) Download

func (h *HTTP) Download(urlStr, host, port, user, password string, filePath, targetPath string) (string, error)

Download HTTP 下载方法

type SFTP

type SFTP struct {
}

SFTP 结构体

func (*SFTP) Download

func (s *SFTP) Download(urlStr, host, port, user, password string, filePath, targetPath string) (fileName string, err error)

Download SFTP 下载文件

type Tool

type Tool interface {
	Download(urlStr, host, port, user, password string, filePath, targetPath string) (string, error)
}

Tool 下载接口结构体

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL