You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 lines
669 B

package tos_test
import (
"context"
"yunyan/lego/sys/sdk/bytedance/tos"
"fmt"
"os"
"testing"
)
func Test_Sys(t *testing.T) {
if err := tos.OnInit(nil,
tos.SetAsccessKey("AKLTYjQ4NTVjZjkyMGQ1NGRhNWIwODA4YmNmZmU0ZmYwYTg"),
tos.SetSecretKey("TXprNFpEQTFZV1JpTTJGbE5HRTFZemcwWXpFNVptSTBOVGN6TVRnM05XTQ=="),
tos.SetRegion("cn-shanghai"),
tos.SetBucketName("insightcube"),
); err != nil {
return
} else {
var file *os.File
defer file.Close()
if file, err = os.Open("./liwei.text"); err != nil {
fmt.Println("打开文件失败!", err)
return
}
err = tos.Put(context.Background(), "./liwei.text", file)
fmt.Printf("results:%v", err)
}
}