Need to improve the interface in the future
This commit is contained in:
@@ -54,10 +54,4 @@ func main() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Case3 put object by local file
|
|
||||||
_, err = c.Object.PutFromFile(context.Background(), name, "./test10M", nil)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
17
object.go
17
object.go
@@ -105,16 +105,17 @@ func (s *ObjectService) Put(ctx context.Context, name string, r io.Reader, opt *
|
|||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO Not Suggest use for now, need to improve
|
||||||
// PutFromFile put object from local file
|
// PutFromFile put object from local file
|
||||||
func (s *ObjectService) PutFromFile(ctx context.Context, name string, filePath string, opt *ObjectPutOptions) (*Response, error) {
|
// func (s *ObjectService) PutFromFile(ctx context.Context, name string, filePath string, opt *ObjectPutOptions) (*Response, error) {
|
||||||
fd, err := os.Open(filePath)
|
// fd, err := os.Open(filePath)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return nil, err
|
// return nil, err
|
||||||
}
|
// }
|
||||||
defer fd.Close()
|
// defer fd.Close()
|
||||||
|
|
||||||
return s.Put(ctx, name, fd, opt)
|
// return s.Put(ctx, name, fd, opt)
|
||||||
}
|
// }
|
||||||
|
|
||||||
// ObjectCopyHeaderOptions is the head option of the Copy
|
// ObjectCopyHeaderOptions is the head option of the Copy
|
||||||
type ObjectCopyHeaderOptions struct {
|
type ObjectCopyHeaderOptions struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user