MCPcopy Index your code
hub / github.com/jetify-com/devbox / download

Function download

internal/pullbox/download.go:13–30  ·  view source on GitHub ↗

Download downloads a file from the specified URL

(url string)

Source from the content-addressed store, hash-verified

11
12// Download downloads a file from the specified URL
13func download(url string) ([]byte, error) {
14 response, err := http.Get(url)
15 if err != nil {
16 return nil, err
17 }
18 defer response.Body.Close()
19
20 if response.StatusCode != http.StatusOK {
21 return nil, fmt.Errorf("failed to download file: %s", response.Status)
22 }
23
24 data, err := io.ReadAll(response.Body)
25 if err != nil {
26 return nil, err
27 }
28
29 return data, nil
30}

Callers 1

PullMethod · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected