pcscommand

package
v3.5.5+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2018 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Overview

Package pcscommand 命令包

Index

Constants

View Source
const (
	//DownloadSuffix 文件下载后缀
	DownloadSuffix = ".BaiduPCS-Go-downloading"
	//StrDownloadInitError 初始化下载发生错误
	StrDownloadInitError = "初始化下载发生错误"
	// DefaultDownloadMaxRetry 默认下载失败最大重试次数
	DefaultDownloadMaxRetry = 3
)
View Source
const (

	// DefaultUploadMaxRetry 默认上传失败最大重试次数
	DefaultUploadMaxRetry = 3
)

Variables

View Source
var (
	// ErrNotSupportChecksum 文件不支持校验
	ErrNotSupportChecksum = errors.New("该文件不支持校验")
	// ErrChecksumFailed 文件校验失败
	ErrChecksumFailed = errors.New("该文件校验失败, 文件md5值与服务器记录的不匹配")
)
View Source
var (
	// BgMap 后台
	BgMap = BgTasks{
		// contains filtered or unexported fields
	}
)
View Source
var (
	// DefaultRunner 默认 Runner
	DefaultRunner = Runner{
		Output: os.Stdout,
	}
)

Functions

func GetActiveUser

func GetActiveUser() *pcsconfig.Baidu

GetActiveUser 获取当前登录的百度帐号

func GetBaiduPCS

func GetBaiduPCS() *baidupcs.BaiduPCS

GetBaiduPCS 从配置读取BaiduPCS

func RunBgDownload

func RunBgDownload(paths []string, options *DownloadOptions)

RunBgDownload 执行后台下载

func RunChangeDirectory

func RunChangeDirectory(path string, isList bool)

RunChangeDirectory 执行更改工作目录

func RunCloudDlAddTask

func RunCloudDlAddTask(sourceURLs []string, savePath string)

RunCloudDlAddTask 执行添加离线下载任务

func RunCloudDlCancelTask

func RunCloudDlCancelTask(taskIDs []int64)

RunCloudDlCancelTask 取消离线下载任务

func RunCloudDlClearTask

func RunCloudDlClearTask()

RunCloudDlClearTask 清空离线下载任务记录

func RunCloudDlDeleteTask

func RunCloudDlDeleteTask(taskIDs []int64)

RunCloudDlDeleteTask 删除离线下载任务

func RunCloudDlListTask

func RunCloudDlListTask()

RunCloudDlListTask 查询离线下载任务列表

func RunCloudDlQueryTask

func RunCloudDlQueryTask(taskIDs []int64)

RunCloudDlQueryTask 精确查询离线下载任务

func RunCopy

func RunCopy(paths ...string)

RunCopy 执行 批量拷贝文件/目录

func RunCreateSuperFile

func RunCreateSuperFile(targetPath string, blockList ...string)

RunCreateSuperFile 执行分片上传—合并分片文件

func RunDownload

func RunDownload(paths []string, options *DownloadOptions)

RunDownload 执行下载网盘内文件

func RunExport

func RunExport(pcspaths []string, rootPath string)

RunExport 执行导出文件和目录

func RunGetMeta

func RunGetMeta(path string)

RunGetMeta 执行 获取单个文件/目录的元信息

func RunGetQuota

func RunGetQuota()

RunGetQuota 执行 获取当前用户空间配额信息, 并输出

func RunLocateDownload

func RunLocateDownload(pcspaths ...string)

RunLocateDownload 执行获取直链

func RunLogin

func RunLogin(username, password string) (bduss, ptoken, stoken string, err error)

RunLogin 登录百度帐号

func RunLs

func RunLs(path string, lsOptions *LsOptions, orderOptions *baidupcs.OrderOptions)

RunLs 执行列目录

func RunMkdir

func RunMkdir(path string)

RunMkdir 执行 创建目录

func RunMove

func RunMove(paths ...string)

RunMove 执行 批量 重命名/移动 文件/目录

func RunRapidUpload

func RunRapidUpload(targetPath, contentMD5, sliceMD5, crc32 string, length int64)

RunRapidUpload 执行秒传文件, 前提是知道文件的大小, md5, 前256KB切片的 md5, crc32

func RunRemove

func RunRemove(paths ...string)

RunRemove 执行 批量删除文件/目录

func RunSearch

func RunSearch(targetPath, keyword string, opt *SearchOptions)

func RunShareCancel

func RunShareCancel(shareIDs []int64)

RunShareCancel 执行取消分享

func RunShareList

func RunShareList()

RunShareList 执行列出分享列表

func RunShareSet

func RunShareSet(paths []string, option *baidupcs.ShareOption)

RunShareSet 执行分享

func RunTree

func RunTree(path string)

RunTree 列出树形图

func RunUpload

func RunUpload(localPaths []string, savePath string, opt *UploadOptions)

RunUpload 执行文件上传

Types

type BgDTaskItem

type BgDTaskItem struct {
	// contains filtered or unexported fields
}

BgDTaskItem 后台任务详情

func (*BgDTaskItem) TaskID

func (t *BgDTaskItem) TaskID() int

TaskID 返回后台任务 id

type BgTasks

type BgTasks struct {
	// contains filtered or unexported fields
}

BgTasks 后台任务

func (*BgTasks) NewID

func (b *BgTasks) NewID() int64

NewID 返回生成的 ID

func (*BgTasks) PrintAllBgTask

func (b *BgTasks) PrintAllBgTask()

PrintAllBgTask 输出所有的后台任务

type DownloadOptions

type DownloadOptions struct {
	IsTest               bool
	IsPrintStatus        bool
	IsExecutedPermission bool
	IsOverwrite          bool
	IsShareDownload      bool
	IsLocateDownload     bool
	IsStreaming          bool
	SaveTo               string
	Parallel             int
	Load                 int
	MaxRetry             int
	NoCheck              bool
	Out                  io.Writer
}

DownloadOptions 下载可选参数

type ListTask

type ListTask struct {
	ID       int // 任务id
	MaxRetry int // 最大重试次数
	// contains filtered or unexported fields
}

ListTask 队列状态 (基类)

type LsOptions

type LsOptions struct {
	Total bool
}

LsOptions 列目录可选项

type Runner

type Runner struct {
	Output       io.Writer
	IsBackground bool
}

Runner 执行器

type SearchOptions

type SearchOptions struct {
	Total   bool
	Recurse bool
}

type StepUpload

type StepUpload int

StepUpload 上传步骤

const (
	// StepUploadInit 初始化步骤
	StepUploadInit StepUpload = iota
	// StepUploadRapidUpload 秒传步骤
	StepUploadRapidUpload
	// StepUploadUpload 正常上传步骤
	StepUploadUpload
)

type UploadOptions

type UploadOptions struct {
	Parallel       int
	MaxRetry       int
	NotRapidUpload bool
	NotFixMD5      bool
	NotSplitFile   bool // 禁用分片上传
}

Jump to

Keyboard shortcuts

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