Documentation ¶
Index ¶
- Constants
- Variables
- type BaiduPCS
- func (pcs *BaiduPCS) CloudDlAddTask(sourceURL, savePath string) (taskID int64, err error)
- func (pcs *BaiduPCS) CloudDlCancelTask(taskID int64) (err error)
- func (pcs *BaiduPCS) CloudDlDeleteTask(taskID int64) (err error)
- func (pcs *BaiduPCS) CloudDlListTask() (cl CloudDlTaskList, err error)
- func (pcs *BaiduPCS) CloudDlQueryTask(taskIDs []int64) (cl CloudDlTaskList, err error)
- func (pcs *BaiduPCS) Copy(cpmvJSON ...*CpMvJSON) (err 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, err error)
- func (pcs *BaiduPCS) FilesDirectoriesList(path string, recurse bool) (data FileDirectoryList, err error)
- func (pcs *BaiduPCS) FilesDirectoriesMeta(path string) (data *FileDirectory, err error)
- func (pcs *BaiduPCS) Isdir(pcspath string) bool
- func (pcs *BaiduPCS) Mkdir(pcspath string) (err error)
- func (pcs *BaiduPCS) Move(cpmvJSON ...*CpMvJSON) (err error)
- func (pcs *BaiduPCS) PrepareCloudDlAddTask(sourceURL, savePath string) (dataReadCloser io.ReadCloser, err error)
- func (pcs *BaiduPCS) PrepareCloudDlCancelTask(taskID int64) (dataReadCloser io.ReadCloser, err error)
- func (pcs *BaiduPCS) PrepareCloudDlDeleteTask(taskID int64) (dataReadCloser io.ReadCloser, err error)
- func (pcs *BaiduPCS) PrepareCloudDlListTask() (dataReadCloser io.ReadCloser, err error)
- func (pcs *BaiduPCS) PrepareCloudDlQueryTask(taskIDs string) (dataReadCloser io.ReadCloser, err error)
- func (pcs *BaiduPCS) PrepareCopy(cpmvJSON ...*CpMvJSON) (dataReadCloser io.ReadCloser, err error)
- func (pcs *BaiduPCS) PrepareFilesDirectoriesBatchMeta(paths ...string) (dataReadCloser io.ReadCloser, err error)
- func (pcs *BaiduPCS) PrepareFilesDirectoriesList(path string, recurse bool) (dataReadCloser io.ReadCloser, err error)
- func (pcs *BaiduPCS) PrepareMkdir(pcspath string) (dataReadCloser io.ReadCloser, err error)
- func (pcs *BaiduPCS) PrepareMove(cpmvJSON ...*CpMvJSON) (dataReadCloser io.ReadCloser, err error)
- func (pcs *BaiduPCS) PrepareQuotaInfo() (dataReadCloser io.ReadCloser, err error)
- func (pcs *BaiduPCS) PrepareRapidUpload(targetPath, contentMD5, sliceMD5, crc32 string, length int64) (dataReadCloser io.ReadCloser, err error)
- func (pcs *BaiduPCS) PrepareRemove(paths ...string) (dataReadCloser io.ReadCloser, err error)
- func (pcs *BaiduPCS) PrepareRename(from, to string) (dataReadCloser io.ReadCloser, err error)
- func (pcs *BaiduPCS) PrepareUpload(targetPath string, uploadFunc UploadFunc) (dataReadCloser io.ReadCloser, err error)
- func (pcs *BaiduPCS) PrepareUploadCreateSuperFile(targetPath string, blockList ...string) (dataReadCloser io.ReadCloser, err error)
- func (pcs *BaiduPCS) PrepareUploadTmpFile(uploadFunc UploadFunc) (dataReadCloser io.ReadCloser, err error)
- func (pcs *BaiduPCS) QuotaInfo() (quota, used int64, err error)
- func (pcs *BaiduPCS) RapidUpload(targetPath, contentMD5, sliceMD5, crc32 string, length int64) (err error)
- func (pcs *BaiduPCS) Remove(paths ...string) (err error)
- func (pcs *BaiduPCS) Rename(from, to string) (err error)
- func (pcs *BaiduPCS) Upload(targetPath string, uploadFunc UploadFunc) (err error)
- func (pcs *BaiduPCS) UploadCreateSuperFile(targetPath string, blockList ...string) (err error)
- func (pcs *BaiduPCS) UploadTmpFile(uploadFunc UploadFunc) (md5 string, err error)
- type CloudDlFileInfo
- type CloudDlTaskInfo
- type CloudDlTaskList
- type CpMvJSON
- type CpMvListJSON
- type DownloadFunc
- type ErrInfo
- type FileDirectory
- type FileDirectoryList
- type PathJSON
- type PathsListJSON
- type UploadFunc
Constants ¶
const ( // OperationQuotaInfo 获取当前用户空间配额信息 OperationQuotaInfo = "获取当前用户空间配额信息" // OperationFilesDirectoriesBatchMeta 获取文件/目录的元信息 OperationFilesDirectoriesBatchMeta = "获取文件/目录的元信息" // OperationFilesDirectoriesList 获取目录下的文件列表 OperationFilesDirectoriesList = "获取目录下的文件列表" // OperationRemove 删除文件/目录 OperationRemove = "删除文件/目录" // OperationMkdir 创建目录 OperationMkdir = "创建目录" // OperationRename 重命名文件/目录 OperationRename = "重命名文件/目录" // OperationCopy 拷贝文件/目录 OperationCopy = "拷贝文件/目录" // OperationMove 移动文件/目录 OperationMove = "移动文件/目录" // OperationRapidUpload 秒传文件 OperationRapidUpload = "秒传文件" // OperationUpload 上传单个文件 OperationUpload = "上传单个文件" // OperationUploadTmpFile 分片上传—文件分片及上传 OperationUploadTmpFile = "分片上传—文件分片及上传" // OperationUploadCreateSuperFile 分片上传—合并分片文件 OperationUploadCreateSuperFile = "分片上传—合并分片文件" // OperationFileDownload 下载单个文件 OperationFileDownload = "下载单个文件" // OperationStreamFileDownload 下载流式文件 OperationStreamFileDownload = "下载流式文件" // OperationCloudDlAddTask 添加离线下载任务 OperationCloudDlAddTask = "添加离线下载任务" // OperationCloudDlQueryTask 精确查询离线下载任务 OperationCloudDlQueryTask = "精确查询离线下载任务" // OperationCloudDlListTask 查询离线下载任务列表 OperationCloudDlListTask = "查询离线下载任务列表" // OperationCloudDlCancelTask 取消离线下载任务 OperationCloudDlCancelTask = "取消离线下载任务" // OperationCloudDlDeleteTask 删除离线下载任务 OperationCloudDlDeleteTask = "删除离线下载任务" )
const ( // StrRemoteError 远端服务器返回错误 StrRemoteError = "远端服务器返回错误" // StrJSONParseError json 数据解析失败 StrJSONParseError = "json 数据解析失败" )
Variables ¶
var ( // AppID 百度 PCS 应用 ID AppID int )
Functions ¶
This section is empty.
Types ¶
type BaiduPCS ¶
type BaiduPCS struct {
// contains filtered or unexported fields
}
BaiduPCS 百度 PCS API 详情
func (*BaiduPCS) CloudDlAddTask ¶
CloudDlAddTask 添加离线下载任务
func (*BaiduPCS) CloudDlCancelTask ¶
CloudDlCancelTask 取消离线下载任务
func (*BaiduPCS) CloudDlDeleteTask ¶
CloudDlDeleteTask 删除离线下载任务
func (*BaiduPCS) CloudDlListTask ¶
func (pcs *BaiduPCS) CloudDlListTask() (cl CloudDlTaskList, err error)
CloudDlListTask 查询离线下载任务列表
func (*BaiduPCS) CloudDlQueryTask ¶
func (pcs *BaiduPCS) CloudDlQueryTask(taskIDs []int64) (cl CloudDlTaskList, err 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, err error)
FilesDirectoriesBatchMeta 获取多个文件/目录的元信息
func (*BaiduPCS) FilesDirectoriesList ¶
func (pcs *BaiduPCS) FilesDirectoriesList(path string, recurse bool) (data FileDirectoryList, err error)
FilesDirectoriesList 获取目录下的文件和目录列表, 可选是否递归
func (*BaiduPCS) FilesDirectoriesMeta ¶
func (pcs *BaiduPCS) FilesDirectoriesMeta(path string) (data *FileDirectory, err error)
FilesDirectoriesMeta 获取单个文件/目录的元信息
func (*BaiduPCS) PrepareCloudDlAddTask ¶
func (pcs *BaiduPCS) PrepareCloudDlAddTask(sourceURL, savePath string) (dataReadCloser io.ReadCloser, err error)
PrepareCloudDlAddTask 添加离线下载任务, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareCloudDlCancelTask ¶
func (pcs *BaiduPCS) PrepareCloudDlCancelTask(taskID int64) (dataReadCloser io.ReadCloser, err error)
PrepareCloudDlCancelTask 取消离线下载任务, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareCloudDlDeleteTask ¶
func (pcs *BaiduPCS) PrepareCloudDlDeleteTask(taskID int64) (dataReadCloser io.ReadCloser, err error)
PrepareCloudDlDeleteTask 取消离线下载任务, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareCloudDlListTask ¶
func (pcs *BaiduPCS) PrepareCloudDlListTask() (dataReadCloser io.ReadCloser, err error)
PrepareCloudDlListTask 查询离线下载任务列表, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareCloudDlQueryTask ¶
func (pcs *BaiduPCS) PrepareCloudDlQueryTask(taskIDs string) (dataReadCloser io.ReadCloser, err error)
PrepareCloudDlQueryTask 精确查询离线下载任务, 只返回服务器响应数据和错误信息, taskids 例子: 12123,234234,2344, 用逗号隔开多个 task_id
func (*BaiduPCS) PrepareCopy ¶
func (pcs *BaiduPCS) PrepareCopy(cpmvJSON ...*CpMvJSON) (dataReadCloser io.ReadCloser, err error)
PrepareCopy 批量拷贝文件/目录, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareFilesDirectoriesBatchMeta ¶
func (pcs *BaiduPCS) PrepareFilesDirectoriesBatchMeta(paths ...string) (dataReadCloser io.ReadCloser, err error)
PrepareFilesDirectoriesBatchMeta 获取多个文件/目录的元信息, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareFilesDirectoriesList ¶
func (pcs *BaiduPCS) PrepareFilesDirectoriesList(path string, recurse bool) (dataReadCloser io.ReadCloser, err error)
PrepareFilesDirectoriesList 获取目录下的文件和目录列表, 可选是否递归, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareMkdir ¶
func (pcs *BaiduPCS) PrepareMkdir(pcspath string) (dataReadCloser io.ReadCloser, err error)
PrepareMkdir 创建目录, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareMove ¶
func (pcs *BaiduPCS) PrepareMove(cpmvJSON ...*CpMvJSON) (dataReadCloser io.ReadCloser, err error)
PrepareMove 批量移动文件/目录, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareQuotaInfo ¶
func (pcs *BaiduPCS) PrepareQuotaInfo() (dataReadCloser io.ReadCloser, err error)
PrepareQuotaInfo 获取当前用户空间配额信息, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareRapidUpload ¶
func (pcs *BaiduPCS) PrepareRapidUpload(targetPath, contentMD5, sliceMD5, crc32 string, length int64) (dataReadCloser io.ReadCloser, err error)
PrepareRapidUpload 秒传文件, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareRemove ¶
func (pcs *BaiduPCS) PrepareRemove(paths ...string) (dataReadCloser io.ReadCloser, err error)
PrepareRemove 批量删除文件/目录, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareRename ¶
func (pcs *BaiduPCS) PrepareRename(from, to string) (dataReadCloser io.ReadCloser, err error)
PrepareRename 重命名文件/目录, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareUpload ¶
func (pcs *BaiduPCS) PrepareUpload(targetPath string, uploadFunc UploadFunc) (dataReadCloser io.ReadCloser, err error)
PrepareUpload 上传单个文件, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareUploadCreateSuperFile ¶
func (pcs *BaiduPCS) PrepareUploadCreateSuperFile(targetPath string, blockList ...string) (dataReadCloser io.ReadCloser, err error)
PrepareUploadCreateSuperFile 分片上传—合并分片文件, 只返回服务器响应数据和错误信息
func (*BaiduPCS) PrepareUploadTmpFile ¶
func (pcs *BaiduPCS) PrepareUploadTmpFile(uploadFunc UploadFunc) (dataReadCloser io.ReadCloser, err error)
PrepareUploadTmpFile 分片上传—文件分片及上传, 只返回服务器响应数据和错误信息
func (*BaiduPCS) RapidUpload ¶
func (pcs *BaiduPCS) RapidUpload(targetPath, contentMD5, sliceMD5, crc32 string, length int64) (err error)
RapidUpload 秒传文件
func (*BaiduPCS) Upload ¶
func (pcs *BaiduPCS) Upload(targetPath string, uploadFunc UploadFunc) (err error)
Upload 上传单个文件
func (*BaiduPCS) UploadCreateSuperFile ¶
UploadCreateSuperFile 分片上传—合并分片文件
func (*BaiduPCS) UploadTmpFile ¶
func (pcs *BaiduPCS) UploadTmpFile(uploadFunc UploadFunc) (md5 string, err error)
UploadTmpFile 分片上传—文件分片及上传
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 ErrInfo ¶
type ErrInfo struct { Operation string `json:"-"` // 正在进行的操作 ErrCode int `json:"error_code"` // 错误代码 ErrMsg string `json:"error_msg"` // 错误消息 }
ErrInfo 远端服务器返回的错误信息
func NewErrorInfo ¶
NewErrorInfo 提供operation操作名称, 返回 *ErrInfo
type FileDirectory ¶
type FileDirectory struct { FsID int64 // fs_id Path string // 路径 Filename string // 文件名 或 目录名 Ctime int64 // 创建日期 Mtime int64 // 修改日期 MD5 string // md5 值 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 PathsListJSON ¶
type PathsListJSON struct {
List []*PathJSON `json:"list"`
}
PathsListJSON 网盘路径列表