// Open an object for read
Open an object for read
// Open an object for read
func (o *Object) Open(options ...fs.OpenOption) (in io.ReadCloser, err error) {
	key := o.fs.root + o.remote
	req := s3.GetObjectInput{
		Bucket: &o.fs.bucket,
		Key:    &key,
	}
	for _, option := range options {
		switch option.(type) {
		case *fs.RangeOption, *fs.SeekOption:
			_, value := option.Header()
			req.Range = &value
		default:
			if option.Mandatory() {
				fs.Logf(o, "Unsupported mandatory option: %v", option)
			}
		}
	}
	resp, err := o.fs.c.GetObject(&req)
	if err, ok := err.(awserr.RequestFailure); ok {
		if err.Code() == "InvalidObjectState" {
			return nil, errors.Errorf("Object in GLACIER, restore first: %v", key)
		}
	}
	if err != nil {
		return nil, err
	}
	return resp.Body, nil
}
func ( o * Object ) Open ( options ... fs . OpenOption ) ( in io . ReadCloser , err error ) { key := o . fs . root + o . remote req := s3 . GetObjectInput { Bucket : & o . fs . bucket , Key : & key , } for _ , option := range options { switch option . ( type ) { case * fs . RangeOption , * fs . SeekOption : _ , value := option . Header ( ) req . Range = & value default : if option . Mandatory ( ) { fs . Logf ( o , " " , option ) } } } resp , err := o . fs . c . GetObject ( & req ) if err , ok := err . ( awserr . RequestFailure ) ; ok { if err . Code ( ) == " " { return nil , errors . Errorf ( " " , key ) } } if err != nil { return nil , err } return resp . Body , nil }
Open an object for read
Open an object for read