Open an object for read
(ctx context.Context, options ...fs.OpenOption)
| 1199 | |
| 1200 | // Open an object for read |
| 1201 | func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.ReadCloser, err error) { |
| 1202 | if o.id == "" { |
| 1203 | return nil, errors.New("can't download - no id") |
| 1204 | } |
| 1205 | fs.FixRangeOption(options, o.size) |
| 1206 | var resp *http.Response |
| 1207 | opts := rest.Opts{ |
| 1208 | Method: "GET", |
| 1209 | RootURL: o.id, |
| 1210 | Path: "/data", |
| 1211 | Options: options, |
| 1212 | } |
| 1213 | err = o.fs.pacer.Call(func() (bool, error) { |
| 1214 | resp, err = o.fs.srv.Call(ctx, &opts) |
| 1215 | return shouldRetry(ctx, resp, err) |
| 1216 | }) |
| 1217 | if err != nil { |
| 1218 | return nil, err |
| 1219 | } |
| 1220 | return resp.Body, err |
| 1221 | } |
| 1222 | |
| 1223 | // createFile makes an (empty) file with pathID as parent and name leaf and returns the ID |
| 1224 | func (f *Fs) createFile(ctx context.Context, pathID, leaf, mimeType string) (newID string, err error) { |
nothing calls this directly
no test coverage detected