我正在使用 Goamz 包,并且可以使用一些帮助bucket.Multi来将 HTTP GET 响应流式传输到 S3。我将通过分块 HTTP 下载 2 GB 以上的文件,我想将其直接流式传输到 S3 存储桶中。看来我需要resp.Body用一些东西来包装,以便我可以将 的实现传递s3.ReaderAtSeeker给multi.PutAll// set up s3auth, _ := aws.EnvAuth()s3Con := s3.New(auth, aws.USEast)bucket := s3Con.Bucket("bucket-name")// make http request to URLresp, err := http.Get(export_url)if err != nil { fmt.Printf("Get error %v\n", err) return}defer resp.Body.Close()// set up multi-part multi, err := bucket.InitMulti(s3Path, "text/plain", s3.Private, s3.Options{})if err != nil { fmt.Printf("InitMulti error %v\n", err) return}// Need struct that implements: s3.ReaderAtSeeker// type ReaderAtSeeker interface {// io.ReaderAt// io.ReadSeeker// }rs := // Question: what can i wrap `resp.Body` in?parts, err := multi.PutAll(rs, 5120)if err != nil { fmt.Printf("PutAll error %v\n", err) return}err = multi.Complete(parts)if err != nil { fmt.Printf("Complete error %v\n", err) return}目前,我在尝试运行我的程序时收到以下(预期的)错误:./main.go:50: cannot use resp.Body (type io.ReadCloser) as type s3.ReaderAtSeeker in argument to multi.PutAll: io.ReadCloser does not implement s3.ReaderAtSeeker (missing ReadAt method)
2 回答
- 2 回答
- 0 关注
- 243 浏览
添加回答
举报
0/150
提交
取消