download

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(fid uint64, targetPath string) error
func GetDlink(accessToken string, fsids []uint64) ([]map[string]string, error)

Types

type FileItem added in v0.0.5

type FileItem struct {
	Category       int               `json:"category"`
	FsID           int64             `json:"fs_id"`
	IsDir          int               `json:"isdir"`
	LocalCtime     int64             `json:"local_ctime"`
	LocalMtime     int64             `json:"local_mtime"`
	MD5            string            `json:"md5"`
	Path           string            `json:"path"`
	ServerCtime    int64             `json:"server_ctime"`
	ServerFilename string            `json:"server_filename"`
	ServerMtime    int64             `json:"server_mtime"`
	Size           int64             `json:"size"`
	Thumbs         map[string]string `json:"thumbs"`
}

type FileListReturn

type FileListReturn struct {
	ErrorNo   int          `json:"errno"`
	GuidInfo  string       `json:"guid_info"`
	List      []FileReturn `json:"list"`
	RequestId int64        `json:"request_id"`
	Guid      int          `json:"guid"`
}

func GetFileList

func GetFileList(accessToken, dir, order, start, folder string, limit, desc int32) FileListReturn

GetFileList dir: /来自:back设备 limit: int; desc int; order string(time); start string("0");forlder string("0");

type FileMetasArg

type FileMetasArg struct {
	Fsids []uint64 `json:"fsids"`
	Path  string   `json:"path"` //查询共享目录或专属空间内文件时需要
}

func NewFileMetasArg

func NewFileMetasArg(fsid []uint64, path string) *FileMetasArg

type FileMetasReturn

type FileMetasReturn struct {
	Errno     int                    `json:"errno"`
	Errmsg    string                 `json:"errmsg"`
	RequestID string                 `json:"request_id"`
	Names     map[string]interface{} `json:"names"`
	List      []ListInfo             `json:"list"`
}

func FileMetas

func FileMetas(accessToken string, arg *FileMetasArg) (FileMetasReturn, error)

type FileMultiListReturn added in v0.0.5

type FileMultiListReturn struct {
	Cursor    int        `json:"cursor"`
	Errmsg    string     `json:"errmsg"`
	Errno     int        `json:"errno"`
	HasMore   int        `json:"has_more"`
	List      []FileItem `json:"list"`
	RequestID string     `json:"request_id"`
}

func GetMultiFileList added in v0.0.5

func GetMultiFileList(accessToken, path string, recursion int, order string, desc int, start int, limit int) FileMultiListReturn

type FileReturn

type FileReturn struct {
	TkbindId       int    `json:"tkbind_id"`
	OwnerType      int    `json:"owner_type"`
	RealCategory   string `json:"real_category"`
	ServerFileName string `json:"server_filename"`
	Privacy        int    `json:"privacy"`
	Category       int    `json:"category"`
	Unlist         int    `json:"unlist"`
	FsId           int64  `json:"fs_id"`
	DirEmpty       int    `json:"dir_empty"`
	ServerAtime    int64  `json:"server_atime"`
	ServerCtime    int64  `json:"server_ctime"`
	LocalMtime     int64  `json:"local_mtime"`
	Size           int64  `json:"size"`
	Isdir          int    `json:"isdir"`
	Share          int    `json:"share"`
	Path           string `json:"path"`
	LocalCtime     int64  `json:"local_ctime"`
	ServerMtime    int64  `json:"server_mtime"`
	Empty          int    `json:"empty"`
	OperId         int64  `json:"oper_id"`
	MD5            string `json:"md5"`
}

type ListInfo

type ListInfo struct {
	Size        uint64            `json:"size"`
	Path        string            `json:"path"`
	Isdir       int               `json:"isdir"`
	ServerCtime uint64            `json:"server_ctime"`
	ServerMtime uint64            `json:"server_mtime"`
	Fsid        uint64            `json:"fs_id"`
	OperId      int               `json:"oper_id"`
	Md5         string            `json:"md5"`
	Filename    string            `json:"filename"`
	Category    int               `json:"category"`
	Dlink       string            `json:"dlink"` // 文件才返回dlink
	Duration    int               `json:"duration"`
	Thumbs      map[string]string `json:"thumbs"`
}

type ProgressWriter

type ProgressWriter struct {
	Total     int64 // 要下载的文件的总大小
	Completed int64 // 已下载的文件大小
}

ProgressWriter 实现了io.Writer接口,用于显示下载进度

func (*ProgressWriter) DisplayProgress

func (pw *ProgressWriter) DisplayProgress()

DisplayProgress 显示下载进度

func (*ProgressWriter) Write

func (pw *ProgressWriter) Write(p []byte) (int, error)

Write 实现了io.Writer接口的Write方法

Jump to

Keyboard shortcuts

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