MCPcopy Create free account
hub / github.com/PolyhedraZK/ExpanderCompilerCollection / downloadFile

Function downloadFile

ecgo/rust/wrapper/wrapper.go:43–66  ·  view source on GitHub ↗
(url string, filepath string)

Source from the content-addressed store, hash-verified

41var compilePtrLock sync.Mutex
42
43func downloadFile(url string, filepath string) error {
44 out, err := os.Create(filepath)
45 if err != nil {
46 return err
47 }
48 defer out.Close()
49
50 resp, err := http.Get(url)
51 if err != nil {
52 return err
53 }
54 defer resp.Body.Close()
55
56 if resp.StatusCode != http.StatusOK {
57 return fmt.Errorf("bad status: %s", resp.Status)
58 }
59
60 _, err = io.Copy(out, resp.Body)
61 if err != nil {
62 return err
63 }
64
65 return nil
66}
67
68func getUrl(url string) ([]byte, error) {
69 resp, err := http.Get(url)

Callers 1

downloadLibFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected