本文整理匯總了Golang中github.com/ks3sdklib/aws-sdk-go/service/s3.S3.CreateMultipartUpload方法的典型用法代碼示例。如果您正苦於以下問題:Golang S3.CreateMultipartUpload方法的具體用法?Golang S3.CreateMultipartUpload怎麽用?Golang S3.CreateMultipartUpload使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/ks3sdklib/aws-sdk-go/service/s3.S3
的用法示例。
在下文中一共展示了S3.CreateMultipartUpload方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: multipart
func multipart(c *s3.S3) {
key := "中文"
acl := "public-read"
out, _ := c.CreateMultipartUpload(
&s3.CreateMultipartUploadInput{
Bucket: &bucket,
Key: &key,
ACL: &acl,
},
)
uploadid := out.UploadID
var partnum int64
partnum = 1
s := strings.NewReader("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890")
uploadRest, _ := c.UploadPart(
&s3.UploadPartInput{
Bucket: &bucket,
Key: &key,
UploadID: uploadid,
PartNumber: &partnum,
Body: s,
},
)
fmt.Println(uploadRest)
listRet, _ := c.ListParts(
&s3.ListPartsInput{
Bucket: &bucket,
Key: &key,
UploadID: uploadid,
},
)
fmt.Println("123")
listP := listRet.Parts
for i := 0; i < len(listP); i++ {
alistP := listP[i]
fmt.Println(*alistP.PartNumber)
fmt.Println(*alistP.ETag)
}
fmt.Println(*listRet.Key)
fmt.Println("123")
var parts []*s3.CompletedPart
apart := &s3.CompletedPart{
ETag: listRet.Parts[0].ETag,
PartNumber: listRet.Parts[0].PartNumber,
}
parts = append(parts, apart)
comRet, _ := c.CompleteMultipartUpload(
&s3.CompleteMultipartUploadInput{
Bucket: &bucket,
Key: &key,
UploadID: uploadid,
MultipartUpload: &s3.CompletedMultipartUpload{
Parts: parts,
},
},
)
fmt.Println(comRet)
}