MCPcopy Create free account
hub / github.com/dolanor/rip / ContentTypeDecoder

Function ContentTypeDecoder

encoding/encoding.go:63–70  ·  view source on GitHub ↗

ContentTypeDecoder decodes the encoded data from r based on the Content-Type header value and the codecs that are available. If no codec is found, it returns a [ErrNoEncoderAvailable].

(r io.Reader, contentTypeHeader string, codecs Codecs)

Source from the content-addressed store, hash-verified

61// and the codecs that are available.
62// If no codec is found, it returns a [ErrNoEncoderAvailable].
63func ContentTypeDecoder(r io.Reader, contentTypeHeader string, codecs Codecs) (Decoder, error) {
64 decoder, ok := codecs.Codecs[contentTypeHeader]
65 if !ok {
66 return nil, ErrNoEncoderAvailable
67 }
68
69 return decoder.NewDecoder(r), nil
70}
71
72// Encoder writes encoded value to an output stream.
73type Encoder interface {

Callers 3

decodeFunction · 0.92
decodeInFunction · 0.92
updatePathIDFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected