Documentation ¶
Index ¶
- Constants
- type BaiduFileInfo
- type BaiduNetdisk
- func (d *BaiduNetdisk) AccessToken() string
- func (d *BaiduNetdisk) Delete(path string) error
- func (d *BaiduNetdisk) Download(path string) (io.ReadCloser, int64, error)
- func (d *BaiduNetdisk) DownloadWithOffset(path string, offset int64) (io.ReadCloser, int64, error)
- func (d *BaiduNetdisk) IsExist(path string) (bool, error)
- func (d *BaiduNetdisk) MkdirAll(dirPath string) (err error)
- func (d *BaiduNetdisk) Range(dir string, deal func(fs.FileInfo) bool) error
- func (d *BaiduNetdisk) RefreshToken() string
- func (d *BaiduNetdisk) SetTmpDir(dir string)
- func (d *BaiduNetdisk) Upload(path string, reader io.ReadCloser, size int64, lastModified time.Time) error
Constants ¶
View Source
const ( PhoAppKey = "8wylQfdIzIpNFOGHZSnOOQ98QLDFvl1U" PhoSecretKey = "lKAurWfMvbUqPddUmOFVgim3Ui1oM56M" )
View Source
const ( ErrorNoSuccess = 0 ErrorNoAccessToken = 111 ErrorNoFileNotExist = -31066 ErrorNoFileNotExist2 = -3 ErrorNoFileNotExist3 = -9 ErrorAlreadyExists = -8 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaiduFileInfo ¶
type BaiduFileInfo struct { FsID uint64 `json:"fs_id"` Path string `json:"path"` Dlink string `json:"dlink"` ServerFilename string `json:"server_filename"` FileSize uint `json:"size"` // Byte ServerModifyTime uint `json:"server_mtime"` ServerCreateTime uint `json:"server_ctime"` LocalModifyTime uint `json:"local_mtime"` LocalCreateTime uint `json:"local_ctime"` FileIsDir uint `json:"isdir"` // 0:file 1:dir }
func (*BaiduFileInfo) IsDir ¶
func (i *BaiduFileInfo) IsDir() bool
func (*BaiduFileInfo) ModTime ¶
func (i *BaiduFileInfo) ModTime() time.Time
func (*BaiduFileInfo) Mode ¶
func (i *BaiduFileInfo) Mode() fs.FileMode
func (*BaiduFileInfo) Name ¶
func (i *BaiduFileInfo) Name() string
func (*BaiduFileInfo) Size ¶
func (i *BaiduFileInfo) Size() int64
func (*BaiduFileInfo) Sys ¶
func (i *BaiduFileInfo) Sys() any
type BaiduNetdisk ¶
type BaiduNetdisk struct { TokenExpireAt int64 // contains filtered or unexported fields }
func NewBaiduNetdiskDrive ¶
func NewBaiduNetdiskDrive(refreshToken, accessToken string) (*BaiduNetdisk, error)
func (*BaiduNetdisk) AccessToken ¶
func (d *BaiduNetdisk) AccessToken() string
func (*BaiduNetdisk) Delete ¶
func (d *BaiduNetdisk) Delete(path string) error
func (*BaiduNetdisk) Download ¶
func (d *BaiduNetdisk) Download(path string) (io.ReadCloser, int64, error)
func (*BaiduNetdisk) DownloadWithOffset ¶
func (d *BaiduNetdisk) DownloadWithOffset(path string, offset int64) (io.ReadCloser, int64, error)
func (*BaiduNetdisk) MkdirAll ¶
func (d *BaiduNetdisk) MkdirAll(dirPath string) (err error)
func (*BaiduNetdisk) RefreshToken ¶
func (d *BaiduNetdisk) RefreshToken() string
func (*BaiduNetdisk) SetTmpDir ¶
func (d *BaiduNetdisk) SetTmpDir(dir string)
func (*BaiduNetdisk) Upload ¶
func (d *BaiduNetdisk) Upload(path string, reader io.ReadCloser, size int64, lastModified time.Time) error
Click to show internal directories.
Click to hide internal directories.