MCPcopy
hub / github.com/containerd/containerd / downloadFile

Function downloadFile

integration/client/container_fuzz_test.go:59–82  ·  view source on GitHub ↗

downloadFile downloads a file from a url

(filepath string, url string)

Source from the content-addressed store, hash-verified

57
58// downloadFile downloads a file from a url
59func downloadFile(filepath string, url string) (err error) {
60 out, err := os.Create(filepath)
61 if err != nil {
62 return err
63 }
64 defer out.Close()
65
66 req, err := http.NewRequest("GET", url, nil)
67 if err != nil {
68 return err
69 }
70 resp, err := http.DefaultClient.Do(req)
71 if err != nil {
72 return err
73 }
74 defer resp.Body.Close()
75
76 _, err = io.Copy(out, resp.Body)
77 if err != nil {
78 return err
79 }
80
81 return nil
82}
83
84// initInSteps() performs initialization in several steps
85// The reason for spreading the initialization out in

Callers 1

initInStepsFunction · 0.85

Calls 4

DoMethod · 0.80
CopyMethod · 0.80
CreateMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…