MCPcopy
hub / github.com/crowdsecurity/crowdsec / copyFile

Function copyFile

pkg/csplugin/broker_suite_test.go:67–91  ·  view source on GitHub ↗
(src string, dst string)

Source from the content-addressed store, hash-verified

65}
66
67func copyFile(src string, dst string) error {
68 s, err := os.Open(src)
69 if err != nil {
70 return err
71 }
72 defer s.Close()
73
74 d, err := os.Create(dst)
75 if err != nil {
76 return err
77 }
78 defer d.Close()
79
80 _, err = io.Copy(d, s)
81 if err != nil {
82 return err
83 }
84
85 err = d.Sync()
86 if err != nil {
87 return err
88 }
89
90 return nil
91}
92
93func (s *PluginSuite) SetupTest() {
94 s.SetupSubTest()

Callers 1

SetupSubTestMethod · 0.85

Calls 3

OpenMethod · 0.80
CloseMethod · 0.45
CreateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…