MCPcopy
hub / github.com/tinylib/msgp / ReadFile

Function ReadFile

msgp/file_port.go:18–29  ·  view source on GitHub ↗
(dst Unmarshaler, file *os.File)

Source from the content-addressed store, hash-verified

16}
17
18func ReadFile(dst Unmarshaler, file *os.File) error {
19 if u, ok := dst.(Decodable); ok {
20 return u.DecodeMsg(NewReader(file))
21 }
22
23 data, err := io.ReadAll(file)
24 if err != nil {
25 return err
26 }
27 _, err = dst.UnmarshalMsg(data)
28 return err
29}
30
31func WriteFile(src MarshalSizer, file *os.File) error {
32 if e, ok := src.(Encodable); ok {

Callers 2

TestReadWriteFileFunction · 0.92
BenchmarkWriteReadFileFunction · 0.92

Calls 3

NewReaderFunction · 0.85
DecodeMsgMethod · 0.65
UnmarshalMsgMethod · 0.65

Tested by 2

TestReadWriteFileFunction · 0.74
BenchmarkWriteReadFileFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…