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

Function wrapReader

drive/script/utils.go:335–340  ·  view source on GitHub ↗

wrapReader adapts an io.Reader into an io.ReadCloser. If reader already is a ReadCloser it is returned as-is, otherwise a no-op Close is added.

(reader io.Reader)

Source from the content-addressed store, hash-verified

333// wrapReader adapts an io.Reader into an io.ReadCloser. If reader already is a
334// ReadCloser it is returned as-is, otherwise a no-op Close is added.
335func wrapReader(reader io.Reader) io.ReadCloser {
336 if rc, ok := reader.(io.ReadCloser); ok {
337 return rc
338 }
339 return fakeCloseReader{reader}
340}
341
342type fakeCloseReader struct {
343 io.Reader

Callers 2

GetReaderMethod · 0.85
ThumbnailMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected