Documentation ¶
Overview ¶
Package baidupcs BaiduPCS RESTful API 工具包
Index ¶
- Constants
- Variables
- func FixSliceMD5(slicemd5 string) string
- func GetHTTPScheme(https bool) (scheme string)
- type BaiduPCS
- func (pcs *BaiduPCS) CloudDlAddTask(sourceURL, savePath string) (taskID int64, pcsError pcserror.Error)
- func (pcs *BaiduPCS) CloudDlCancelTask(taskID int64) (pcsError pcserror.Error)
- func (pcs *BaiduPCS) CloudDlDeleteTask(taskID int64) (pcsError pcserror.Error)
- func (pcs *BaiduPCS) CloudDlListTask() (cl CloudDlTaskList, pcsError pcserror.Error)
- func (pcs *BaiduPCS) CloudDlQueryTask(taskIDs []int64) (cl CloudDlTaskList, pcsError pcserror.Error)
- func (pcs *BaiduPCS) Copy(cpmvJSON ...*CpMvJSON) (pcsError pcserror.Error)
- func (pcs *BaiduPCS) DownloadFile(path string, downloadFunc DownloadFunc) (err error)
- func (pcs *BaiduPCS) DownloadStreamFile(path string, downloadFunc DownloadFunc) (err error)
- func (pcs *BaiduPCS) FilesDirectoriesBatchMeta(paths ...string) (data FileDirectoryList, pcsError pcserror.Error)
- func (pcs *BaiduPCS) FilesDirectoriesList(path string, options *OrderOptions) (data FileDirectoryList, pcsError pcserror.Error)
- func (pcs *BaiduPCS) FilesDirectoriesMeta(path string) (data *FileDirectory, pcsError pcserror.Error)
- func (pcs *BaiduPCS) FilesDirectoriesRecurseList(path string, options *OrderOptions, ...) (data FileDirectoryList, pcsError pcserror.Error)
- func (pcs *BaiduPCS) Isdir(pcspath string) (isdir bool, pcsError pcserror.Error)
- func (pcs *BaiduPCS) LocateDownload(pcspath string) (info *URLInfo, pcsError pcserror.Error)
- func (pcs *BaiduPCS) Mkdir(pcspath string) (pcsError pcserror.Error)
- func (pcs *BaiduPCS) Move(cpmvJSON ...*CpMvJSON) (pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareCloudDlAddTask(sourceURL, savePath string) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareCloudDlCancelTask(taskID int64) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareCloudDlDeleteTask(taskID int64) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareCloudDlListTask() (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareCloudDlQueryTask(taskIDs string) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareCopy(cpmvJSON ...*CpMvJSON) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareFilesDirectoriesBatchMeta(paths ...string) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareFilesDirectoriesList(path string, options *OrderOptions) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareLocateDownload(pcspath string) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareMkdir(pcspath string) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareMove(cpmvJSON ...*CpMvJSON) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareQuotaInfo() (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareRapidUpload(targetPath, contentMD5, sliceMD5, crc32 string, length int64) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareRemove(paths ...string) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareRename(from, to string) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareSearch(targetPath, keyword string, recursive bool) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareShareCancel(shareIDs []int64) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareShareList(page int) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareSharePSet(paths []string, period int) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareUK() (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareUpload(targetPath string, uploadFunc UploadFunc) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareUploadCreateSuperFile(targetPath string, blockList ...string) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareUploadPrecreate(targetPath, contentMD5, sliceMD5, crc32 string, size int64, ...) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareUploadSuperfile2(uploadid, targetPath string, partseq int, partOffset int64, ...) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) PrepareUploadTmpFile(uploadFunc UploadFunc) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
- func (pcs *BaiduPCS) QuotaInfo() (quota, used int64, pcsError pcserror.Error)
- func (pcs *BaiduPCS) RapidUpload(targetPath, contentMD5, sliceMD5, crc32 string, length int64) (pcsError pcserror.Error)
- func (pcs *BaiduPCS) Remove(paths ...string) (pcsError pcserror.Error)
- func (pcs *BaiduPCS) Rename(from, to string) (pcsError pcserror.Error)
- func (pcs *BaiduPCS) Search(targetPath, keyword string, recursive bool) (fdl FileDirectoryList, pcsError pcserror.Error)
- func (pcs *BaiduPCS) SetAPPID(appID int)
- func (pcs *BaiduPCS) SetHTTPS(https bool)
- func (pcs *BaiduPCS) SetUserAgent(ua string)
- func (pcs *BaiduPCS) ShareCancel(shareIDs []int64) (pcsError pcserror.Error)
- func (pcs *BaiduPCS) ShareList(page int) (records ShareRecordInfoList, pcsError pcserror.Error)
- func (pcs *BaiduPCS) ShareSet(paths []string, option *ShareOption) (s *Shared, pcsError pcserror.Error)
- func (pcs *BaiduPCS) UK() (uk int64, pcsError pcserror.Error)
- func (pcs *BaiduPCS) URL() *url.URL
- func (pcs *BaiduPCS) Upload(targetPath string, uploadFunc UploadFunc) (pcsError pcserror.Error)
- func (pcs *BaiduPCS) UploadCreateSuperFile(targetPath string, blockList ...string) (pcsError pcserror.Error)
- func (pcs *BaiduPCS) UploadPrecreate(targetPath, contentMD5, sliceMD5, crc32 string, size int64, ...) (precreateInfo *PrecreateInfo, pcsError pcserror.Error)
- func (pcs *BaiduPCS) UploadSuperfile2(uploadid, targetPath string, partseq int, partOffset int64, ...) (md5sum string, pcsError pcserror.Error)
- func (pcs *BaiduPCS) UploadTmpFile(uploadFunc UploadFunc) (md5 string, pcsError pcserror.Error)
- type BlockListJSON
- type CloudDlFileInfo
- type CloudDlTaskInfo
- type CloudDlTaskList
- type CpMvJSON
- type CpMvListJSON
- type DownloadFunc
- type FileDirectory
- type FileDirectoryList
- type HandleFileDirectoryFunc
- type Order
- type OrderBy
- type OrderOptions
- type PathJSON
- type PathsListJSON
- type PrecreateInfo
- type ShareOption
- type ShareRecordInfo
- type ShareRecordInfoList
- type Shared
- type URLInfo
- type UploadFunc
- type UploadSeq
Constants ¶
const ( // OperationGetUK 获取UK OperationGetUK = "获取UK" // OperationQuotaInfo 获取当前用户空间配额信息 OperationQuotaInfo = "获取当前用户空间配额信息" // OperationFilesDirectoriesMeta 获取文件/目录的元信息 OperationFilesDirectoriesMeta = "获取文件/目录的元信息" // OperationFilesDirectoriesList 获取目录下的文件列表 OperationFilesDirectoriesList = "获取目录下的文件列表" // OperationSearch 搜索 OperationSearch = "搜索" // OperationRemove 删除文件/目录 OperationRemove = "删除文件/目录" // OperationMkdir 创建目录 OperationMkdir = "创建目录" // OperationRename 重命名文件/目录 OperationRename = "重命名文件/目录" // OperationCopy 拷贝文件/目录 OperationCopy = "拷贝文件/目录" // OperationMove 移动文件/目录 OperationMove = "移动文件/目录" // OperationRapidUpload 秒传文件 OperationRapidUpload = "秒传文件" // OperationUpload 上传单个文件 OperationUpload = "上传单个文件" // OperationUploadTmpFile 分片上传—文件分片及上传 OperationUploadTmpFile = "分片上传—文件分片及上传" // OperationUploadCreateSuperFile 分片上传—合并分片文件 OperationUploadCreateSuperFile = "分片上传—合并分片文件" // OperationUploadPrecreate 分片上传—Precreate OperationUploadPrecreate = "分片上传—Precreate" // OperationUploadSuperfile2 分片上传—Superfile2 OperationUploadSuperfile2 = "分片上传—Superfile2" // OperationDownloadFile 下载单个文件 OperationDownloadFile = "下载单个文件" // OperationDownloadStreamFile 下载流式文件 OperationDownloadStreamFile = "下载流式文件" // OperationLocateDownload 提取下载链接 OperationLocateDownload = "提取下载链接" // OperationCloudDlAddTask 添加离线下载任务 OperationCloudDlAddTask = "添加离线下载任务" // OperationCloudDlQueryTask 精确查询离线下载任务 OperationCloudDlQueryTask = "精确查询离线下载任务" // OperationCloudDlListTask 查询离线下载任务列表 OperationCloudDlListTask = "查询离线下载任务列表" // OperationCloudDlCancelTask 取消离线下载任务 OperationCloudDlCancelTask = "取消离线下载任务" // OperationCloudDlDeleteTask 删除离线下载任务 OperationCloudDlDeleteTask = "删除离线下载任务" OperationShareSet = "创建分享链接" OperationShareCancel = "取消分享" OperationShareList = "列出分享列表" // PCSBaiduCom pcs api地址 PCSBaiduCom = "pcs.baidu.com" // PanBaiduCom 网盘首页api地址 PanBaiduCom = "pan.baidu.com" // NetdiskUA 网盘客户端ua NetdiskUA = "netdisk;7.8.1;Red;android-android;4.3" )
const ( // OrderByName 根据文件名排序 OrderByName OrderBy = "name" // OrderByTime 根据时间排序 OrderByTime OrderBy = "time" // OrderBySize 根据大小排序, 注意目录无大小 OrderBySize OrderBy = "size" // OrderAsc 升序 OrderAsc Order = "asc" // OrderDesc 降序 OrderDesc Order = "desc" )
const ( // MaxUploadBlockSize 最大上传的文件分片大小 MaxUploadBlockSize = 2 * converter.GB // MinUploadBlockSize 推荐的上传的文件分片大小 MinUploadBlockSize = 128 * converter.MB // RecommendUploadBlockSize 推荐的上传的文件分片大小 RecommendUploadBlockSize = 1 * converter.GB // DefaultSliceMD5 默认的长度为32的slicemd5 DefaultSliceMD5 = "ec87a838931d4d5d2e94a04644788a55" )
Variables ¶
var ( // ErrMD5NotFound 未找到md5 ErrMD5NotFound = errors.New("unknown response data, md5 not found") // ErrSavePathFound 未找到保存路径 ErrSavePathFound = errors.New("unknown response data, file saved path not found") // ErrSeqNotMatch 服务器返回的上传队列不匹配 ErrSeqNotMatch = errors.New("服务器返回的上传队列不匹配") )
var DefaultOrderOptions = &OrderOptions{ By: OrderByName, Order: OrderAsc, }
DefaultOrderOptions 默认的排序
var PublicSuffixList cookiejar.PublicSuffixList = list{}
PublicSuffixList baidupcs PublicSuffixList
Functions ¶
func GetHTTPScheme ¶
GetHTTPScheme 获取 http 协议, https 或 http
Types ¶
type BaiduPCS ¶
type BaiduPCS struct {
// contains filtered or unexported fields
}
BaiduPCS 百度 PCS API 详情
func NewPCSWithClient ¶
func NewPCSWithClient(appID int, client *requester.HTTPClient) *BaiduPCS
NewPCSWithClient 提供app_id, 自定义客户端, 返回 BaiduPCS 对象
func NewPCSWithCookieStr ¶
NewPCSWithCookieStr 提供app_id, cookie 字符串, 返回 BaiduPCS 对象
func (*BaiduPCS) CloudDlAddTask ¶
func (pcs *BaiduPCS) CloudDlAddTask(sourceURL, savePath string) (taskID int64, pcsError pcserror.Error)
CloudDlAddTask 添加离线下载任务
func (*BaiduPCS) CloudDlCancelTask ¶
CloudDlCancelTask 取消离线下载任务
func (*BaiduPCS) CloudDlDeleteTask ¶
CloudDlDeleteTask 删除离线下载任务
func (*BaiduPCS) CloudDlListTask ¶
func (pcs *BaiduPCS) CloudDlListTask() (cl CloudDlTaskList, pcsError pcserror.Error)
CloudDlListTask 查询离线下载任务列表
func (*BaiduPCS) CloudDlQueryTask ¶
func (pcs *BaiduPCS) CloudDlQueryTask(taskIDs []int64) (cl CloudDlTaskList, pcsError pcserror.Error)
CloudDlQueryTask 精确查询离线下载任务
func (*BaiduPCS) DownloadFile ¶
func (pcs *BaiduPCS) DownloadFile(path string, downloadFunc DownloadFunc) (err error)
DownloadFile 下载单个文件
func (*BaiduPCS) DownloadStreamFile ¶
func (pcs *BaiduPCS) DownloadStreamFile(path string, downloadFunc DownloadFunc) (err error)
DownloadStreamFile 下载流式文件
func (*BaiduPCS) FilesDirectoriesBatchMeta ¶
func (pcs *BaiduPCS) FilesDirectoriesBatchMeta(paths ...string) (data FileDirectoryList, pcsError pcserror.Error)
FilesDirectoriesBatchMeta 获取多个文件/目录的元信息
func (*BaiduPCS) FilesDirectoriesList ¶
func (pcs *BaiduPCS) FilesDirectoriesList(path string, options *OrderOptions) (data FileDirectoryList, pcsError pcserror.Error)
FilesDirectoriesList 获取目录下的文件和目录列表
func (*BaiduPCS) FilesDirectoriesMeta ¶
func (pcs *BaiduPCS) FilesDirectoriesMeta(path string) (data *FileDirectory, pcsError pcserror.Error)
FilesDirectoriesMeta 获取单个文件/目录的元信息
func (*BaiduPCS) FilesDirectoriesRecurseList ¶
func (pcs *BaiduPCS) FilesDirectoriesRecurseList(path string, options *OrderOptions, handleFileDirectoryFunc HandleFileDirectoryFunc) (data FileDirectoryList, pcsError pcserror.Error)
FilesDirectoriesRecurseList 递归获取目录下的文件和目录列表
func (*BaiduPCS) LocateDownload ¶
LocateDownload 提取下载链接
func (*BaiduPCS) PrepareCloudDlAddTask ¶
func (pcs *BaiduPCS) PrepareCloudDlAddTask(sourceURL, savePath string) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareCloudDlAddTask 添加离线下载任务, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareCloudDlCancelTask ¶
func (pcs *BaiduPCS) PrepareCloudDlCancelTask(taskID int64) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareCloudDlCancelTask 取消离线下载任务, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareCloudDlDeleteTask ¶
func (pcs *BaiduPCS) PrepareCloudDlDeleteTask(taskID int64) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareCloudDlDeleteTask 取消离线下载任务, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareCloudDlListTask ¶
func (pcs *BaiduPCS) PrepareCloudDlListTask() (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareCloudDlListTask 查询离线下载任务列表, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareCloudDlQueryTask ¶
func (pcs *BaiduPCS) PrepareCloudDlQueryTask(taskIDs string) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareCloudDlQueryTask 精确查询离线下载任务, 只返回服务器响应数据和错误信息, taskids 例子: 12123,234234,2344, 用逗号隔开多个 task_id
func (*BaiduPCS) PrepareCopy ¶
func (pcs *BaiduPCS) PrepareCopy(cpmvJSON ...*CpMvJSON) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareCopy 批量拷贝文件/目录, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareFilesDirectoriesBatchMeta ¶
func (pcs *BaiduPCS) PrepareFilesDirectoriesBatchMeta(paths ...string) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareFilesDirectoriesBatchMeta 获取多个文件/目录的元信息, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareFilesDirectoriesList ¶
func (pcs *BaiduPCS) PrepareFilesDirectoriesList(path string, options *OrderOptions) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareFilesDirectoriesList 获取目录下的文件和目录列表, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareLocateDownload ¶
func (pcs *BaiduPCS) PrepareLocateDownload(pcspath string) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareLocateDownload 提取下载链接, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareMkdir ¶
func (pcs *BaiduPCS) PrepareMkdir(pcspath string) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareMkdir 创建目录, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareMove ¶
func (pcs *BaiduPCS) PrepareMove(cpmvJSON ...*CpMvJSON) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareMove 批量移动文件/目录, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareQuotaInfo ¶
func (pcs *BaiduPCS) PrepareQuotaInfo() (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareQuotaInfo 获取当前用户空间配额信息, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareRapidUpload ¶
func (pcs *BaiduPCS) PrepareRapidUpload(targetPath, contentMD5, sliceMD5, crc32 string, length int64) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareRapidUpload 秒传文件, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareRemove ¶
func (pcs *BaiduPCS) PrepareRemove(paths ...string) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareRemove 批量删除文件/目录, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareRename ¶
func (pcs *BaiduPCS) PrepareRename(from, to string) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareRename 重命名文件/目录, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareSearch ¶
func (pcs *BaiduPCS) PrepareSearch(targetPath, keyword string, recursive bool) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareSearch 按文件名搜索文件, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareShareCancel ¶
func (pcs *BaiduPCS) PrepareShareCancel(shareIDs []int64) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareShareCancel 取消分享, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareShareList ¶
func (pcs *BaiduPCS) PrepareShareList(page int) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareShareList 列出分享列表, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareSharePSet ¶
func (pcs *BaiduPCS) PrepareSharePSet(paths []string, period int) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareSharePSet 私密分享文件, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareUK ¶
func (pcs *BaiduPCS) PrepareUK() (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareUK 获取用户 UK, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareUpload ¶
func (pcs *BaiduPCS) PrepareUpload(targetPath string, uploadFunc UploadFunc) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareUpload 上传单个文件, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareUploadCreateSuperFile ¶
func (pcs *BaiduPCS) PrepareUploadCreateSuperFile(targetPath string, blockList ...string) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareUploadCreateSuperFile 分片上传—合并分片文件, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareUploadPrecreate ¶
func (pcs *BaiduPCS) PrepareUploadPrecreate(targetPath, contentMD5, sliceMD5, crc32 string, size int64, bolckList ...string) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareUploadPrecreate 分片上传—Precreate, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareUploadSuperfile2 ¶
func (pcs *BaiduPCS) PrepareUploadSuperfile2(uploadid, targetPath string, partseq int, partOffset int64, uploadFunc UploadFunc) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
func (*BaiduPCS) PrepareUploadTmpFile ¶
func (pcs *BaiduPCS) PrepareUploadTmpFile(uploadFunc UploadFunc) (dataReadCloser io.ReadCloser, pcsError pcserror.Error)
PrepareUploadTmpFile 分片上传—文件分片及上传, 只返回服务器响应数据和错误信息
func (*BaiduPCS) RapidUpload ¶
func (pcs *BaiduPCS) RapidUpload(targetPath, contentMD5, sliceMD5, crc32 string, length int64) (pcsError pcserror.Error)
RapidUpload 秒传文件
func (*BaiduPCS) Search ¶
func (pcs *BaiduPCS) Search(targetPath, keyword string, recursive bool) (fdl FileDirectoryList, pcsError pcserror.Error)
Search 按文件名搜索文件, 不支持查找目录
func (*BaiduPCS) SetUserAgent ¶
SetUserAgent 设置 User-Agent
func (*BaiduPCS) ShareCancel ¶
ShareCancel 取消分享
func (*BaiduPCS) ShareList ¶
func (pcs *BaiduPCS) ShareList(page int) (records ShareRecordInfoList, pcsError pcserror.Error)
ShareList 列出分享列表
func (*BaiduPCS) ShareSet ¶
func (pcs *BaiduPCS) ShareSet(paths []string, option *ShareOption) (s *Shared, pcsError pcserror.Error)
ShareSet 分享文件
func (*BaiduPCS) Upload ¶
func (pcs *BaiduPCS) Upload(targetPath string, uploadFunc UploadFunc) (pcsError pcserror.Error)
Upload 上传单个文件
func (*BaiduPCS) UploadCreateSuperFile ¶
func (pcs *BaiduPCS) UploadCreateSuperFile(targetPath string, blockList ...string) (pcsError pcserror.Error)
UploadCreateSuperFile 分片上传—合并分片文件
func (*BaiduPCS) UploadPrecreate ¶
func (pcs *BaiduPCS) UploadPrecreate(targetPath, contentMD5, sliceMD5, crc32 string, size int64, bolckList ...string) (precreateInfo *PrecreateInfo, pcsError pcserror.Error)
UploadPrecreate 分片上传—Precreate, 支持检验秒传
func (*BaiduPCS) UploadSuperfile2 ¶
func (pcs *BaiduPCS) UploadSuperfile2(uploadid, targetPath string, partseq int, partOffset int64, uploadFunc UploadFunc) (md5sum string, pcsError pcserror.Error)
UploadSuperfile2 分片上传—Superfile2
func (*BaiduPCS) UploadTmpFile ¶
func (pcs *BaiduPCS) UploadTmpFile(uploadFunc UploadFunc) (md5 string, pcsError pcserror.Error)
UploadTmpFile 分片上传—文件分片及上传
type BlockListJSON ¶
type BlockListJSON struct {
BlockList []string `json:"block_list"`
}
BlockListJSON 文件分块信息JSON
type CloudDlFileInfo ¶
type CloudDlFileInfo struct { FileName string `json:"file_name"` FileSize int64 `json:"file_size"` }
CloudDlFileInfo 离线下载的文件信息
type CloudDlTaskInfo ¶
type CloudDlTaskInfo struct { TaskID int64 Status int // 0下载成功, 1下载进行中, 2系统错误, 3资源不存在, 4下载超时, 5资源存在但下载失败, 6存储空间不足, 7任务取消 StatusText string FileSize int64 // 文件大小 FinishedSize int64 // 文件大小 CreateTime int64 // 创建时间 StartTime int64 // 开始时间 FinishTime int64 // 结束时间 SavePath string // 保存的路径 SourceURL string // 资源地址 TaskName string // 任务名称, 一般为文件名 OdType int FileList []*CloudDlFileInfo Result int // 0查询成功,结果有效,1要查询的task_id不存在 }
CloudDlTaskInfo 离线下载的任务信息
type CloudDlTaskList ¶
type CloudDlTaskList []*CloudDlTaskInfo
CloudDlTaskList 离线下载的任务信息列表
func (CloudDlTaskList) String ¶
func (cl CloudDlTaskList) String() string
type CpMvListJSON ¶
type CpMvListJSON struct {
List []*CpMvJSON `json:"list"`
}
CpMvListJSON []*CpMvJSON 对象数组
func (*CpMvListJSON) String ¶
func (clj *CpMvListJSON) String() string
type DownloadFunc ¶
DownloadFunc 下载文件处理函数
type FileDirectory ¶
type FileDirectory struct { FsID int64 // fs_id Path string // 路径 Filename string // 文件名 或 目录名 Ctime int64 // 创建日期 Mtime int64 // 修改日期 MD5 string // md5 值 BlockListJSON Size int64 // 文件大小 (目录为0) Isdir bool // 是否为目录 Ifhassubdir bool // 是否含有子目录 (只对目录有效) Parent *FileDirectory // 父目录信息 Children FileDirectoryList // 子目录信息 }
FileDirectory 文件或目录的元信息
func (*FileDirectory) String ¶
func (f *FileDirectory) String() string
type FileDirectoryList ¶
type FileDirectoryList []*FileDirectory
FileDirectoryList FileDirectory 的 指针数组
func (FileDirectoryList) AllFilePaths ¶
func (fl FileDirectoryList) AllFilePaths() (pcspaths []string)
AllFilePaths 返回所有的网盘路径, 包括子目录
func (FileDirectoryList) Count ¶
func (fl FileDirectoryList) Count() (fileN, directoryN int64)
Count 获取文件总数和目录总数
func (FileDirectoryList) TotalSize ¶
func (fl FileDirectoryList) TotalSize() int64
TotalSize 获取目录下文件的总大小
type HandleFileDirectoryFunc ¶
type HandleFileDirectoryFunc func(depth int, fd *FileDirectory)
HandleFileDirectoryFunc 处理文件或目录的元信息
type PathsListJSON ¶
type PathsListJSON struct {
List []*PathJSON `json:"list"`
}
PathsListJSON 网盘路径列表
type PrecreateInfo ¶
PrecreateInfo 预提交文件消息返回数据
type URLInfo ¶
type URLInfo struct { URLs []struct { URL string `json:"url"` } `json:"urls"` }
URLInfo 下载链接详情
type UploadFunc ¶
UploadFunc 上传文件处理函数