百度网盘开放平台 Go SDK
# Pan Go Sdk
该代码库为百度网盘开放平台Go语言的SDK,详细请参考官方技术文档<https://pan.baidu.com/union/document/entrance>
## github地址
[https://github.com/jsyzchen/pan](https://github.com/jsyzchen/pan) 欢迎star&issue
## 下载
### 使用Go mod
在您的项目中的`go.mod`文件内添加这行代码
```bash
require github.com/jsyzchen/pan v0.0.1
```
并在项目中引入`github.com/jsyzchen/pan`
```go
import (
"github.com/jsyzchen/pan/auth"
"github.com/jsyzchen/pan/file"
)
```
### 不使用 Go mod
```bash
go get -u github.com/jsyzchen/pan/file
```
## 使用示例
```go
package main
import (
"fmt"
"github.com/jsyzchen/pan/file"
)
func main() {
accessToken := "122.b0a9ab31cc24b429d460cd3ce1f1af97.Yn53jGAwd_1elGgODFvYl1sp9qOYVUDRiVawin5.tbNcEw"
path := "/apps/书梯/CHSS.mkv"
localFilePath := "/Download/CHSS.mkv"
fileUploader := file.NewUploader(accessToken, path, localFilePath)
res, err := fileUploader.Upload()
if err != nil {
fmt.Println("err:", err)
return
}
fmt.Println(res)
}
```
### 更多示例参考
<https://github.com/jsyzchen/pan/tree/main/examples>