MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / dumpDctHash

Method dumpDctHash

testutil/image_hash.go:212–224  ·  view source on GitHub ↗

dumpDctHash writes the DCT hash to a writer

(w io.Writer)

Source from the content-addressed store, hash-verified

210
211// dumpDctHash writes the DCT hash to a writer
212func (h *ImageHash) dumpDctHash(w io.Writer) error {
213 // Write length
214 if err := binary.Write(w, binary.LittleEndian, uint16(len(h.dctHash))); err != nil {
215 return fmt.Errorf("failed to write DCT hash length: %w", err)
216 }
217
218 // Write array
219 if err := binary.Write(w, binary.LittleEndian, h.dctHash); err != nil {
220 return fmt.Errorf("failed to write DCT hash values: %w", err)
221 }
222
223 return nil
224}
225
226// loadDctHash reads a DCT hash from a reader
227func (h *ImageHash) loadDctHash(r io.Reader) error {

Callers 1

DumpMethod · 0.95

Calls 2

ErrorfMethod · 0.80
WriteMethod · 0.45

Tested by

no test coverage detected