MCPcopy Index your code
hub / github.com/aptly-dev/aptly / CopyFile

Function CopyFile

utils/copyfile.go:9–30  ·  view source on GitHub ↗

CopyFile copeis file from src to dst, not preserving attributes

(src, dst string)

Source from the content-addressed store, hash-verified

7
8// CopyFile copeis file from src to dst, not preserving attributes
9func CopyFile(src, dst string) error {
10 sf, err := os.Open(src)
11 if err != nil {
12 return err
13 }
14 defer func() {
15 _ = sf.Close()
16 }()
17
18 df, err := os.Create(dst)
19 if err != nil {
20 return err
21 }
22
23 _, err = io.Copy(df, sf)
24 if err != nil {
25 _ = df.Close()
26 return err
27 }
28
29 return df.Close()
30}

Callers 8

TestImportLegacyMethod · 0.92
TestVerifyLegacyMethod · 0.92
SetUpTestMethod · 0.92
NewChangesFunction · 0.92
PrepareMethod · 0.92
aptlyGraphFunction · 0.92
TestCopyFileMethod · 0.85

Calls 3

OpenMethod · 0.65
CloseMethod · 0.65
CopyMethod · 0.45

Tested by 5

TestImportLegacyMethod · 0.74
TestVerifyLegacyMethod · 0.74
SetUpTestMethod · 0.74
TestCopyFileMethod · 0.68