MCPcopy Create free account
hub / github.com/devld/go-drive / Thumbnail

Method Thumbnail

drive/script/index.go:361–384  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

359}
360
361func (se *scriptDriveEntry) Thumbnail(ctx context.Context) (types.IContentReader, error) {
362 vm, e := se.d.pool.Get(ctx)
363 if e != nil {
364 return nil, e
365 }
366 defer func() { _ = se.d.pool.Return(context.Background(), vm) }()
367 v, e := se.d.call(ctx, vm, "getThumbnail", s.NewContext(vm, ctx), se.s)
368 if e != nil {
369 return nil, e
370 }
371 raw := v.Raw()
372 // A reader was returned. Detach it so it survives the VM being returned to
373 // the pool; the caller owns closing it.
374 if rc := s.DetachReadCloser(vm, raw); rc != nil {
375 return wrapContentReader(rc), nil
376 }
377 if reader := s.GetReader(raw); reader != nil {
378 return wrapContentReader(wrapReader(reader)), nil
379 }
380 // Otherwise a ContentURL was returned.
381 r := types.ContentURL{}
382 v.ParseInto(&r)
383 return drive_util.NewURLContentReader(r.URL, r.Header, r.Proxy), nil
384}

Callers

nothing calls this directly

Calls 9

GetReaderMethod · 0.95
NewURLContentReaderFunction · 0.92
wrapContentReaderFunction · 0.85
wrapReaderFunction · 0.85
ReturnMethod · 0.80
callMethod · 0.80
RawMethod · 0.80
ParseIntoMethod · 0.80
GetMethod · 0.65

Tested by

no test coverage detected