Categorygithub.com/jakeslee/aliyundrive
modulepackage
1.0.2
Repository: https://github.com/jakeslee/aliyundrive.git
Documentation: pkg.go.dev

# README

aliyundrive

FOSSA Status

本项目是基于阿里云盘网页接口封装的 SDK 工具包,可以用于扩展开发其它功能,包含以下特性:

  • 文件下载 URL 获取
  • 文件分片上传
  • 秒传(基于 proof code v1 秒传)
  • 文件移动、重命名、删除等操作
  • 文件批量操作(移动)
  • 文件上传限速

使用

go get github.com/jakeslee/aliyundrive

安装后使用以下方式使用:

package main

import (
	"github.com/jakeslee/aliyundrive"
	"log"
	"os"
)

func main() {
	drive := aliyundrive.NewClient(&aliyundrive.Options{
		AutoRefresh: true,
		UploadRate:  2 * 1024 * 1024, // 限速 2MBps
	})

	cred, err := drive.AddCredential(aliyundrive.NewCredential(&aliyundrive.Credential{
		RefreshToken: "aliyundrive refresh token",
	}))

	file, err := os.OpenFile("/tmp/demo", os.O_RDONLY, 0)
	if err != nil {
		log.Fatal(err)
	}

	fileRapid, rapid, err := drive.UploadFileRapid(cred, &aliyundrive.UploadFileRapidOptions{
		UploadFileOptions: aliyundrive.UploadFileOptions{
			Name:         "name",
			Size:         1000,
			ParentFileId: aliyundrive.DefaultRootFileId,
		},
		File: file,
	})

	log.Printf("file: %v, rapid: %v", fileRapid, rapid)
	// ...
}

感谢

本项目开发过程中大量参考了以下优秀开源项目代码,感谢大佬们的贡献!

License

FOSSA Status

# Packages

No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
ThunkSizeDefault 默认 10MB 大小.

# Variables

No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author