MCPcopy Create free account
hub / github.com/opencontainers/go-digest / FromReader

Method FromReader

algorithm.go:147–155  ·  view source on GitHub ↗

FromReader returns the digest of the reader using the algorithm.

(rd io.Reader)

Source from the content-addressed store, hash-verified

145
146// FromReader returns the digest of the reader using the algorithm.
147func (a Algorithm) FromReader(rd io.Reader) (Digest, error) {
148 digester := a.Digester()
149
150 if _, err := io.Copy(digester.Hash(), rd); err != nil {
151 return "", err
152 }
153
154 return digester.Digest(), nil
155}
156
157// FromBytes digests the input and returns a Digest.
158func (a Algorithm) FromBytes(p []byte) Digest {

Callers 2

FromReaderFunction · 0.80
TestFromsFunction · 0.80

Calls 3

DigesterMethod · 0.95
HashMethod · 0.65
DigestMethod · 0.65

Tested by 1

TestFromsFunction · 0.64