MCPcopy
hub / github.com/nektos/act / CopyFile

Function CopyFile

pkg/common/file.go:10–34  ·  view source on GitHub ↗

CopyFile copy file

(source string, dest string)

Source from the content-addressed store, hash-verified

8
9// CopyFile copy file
10func CopyFile(source string, dest string) (err error) {
11 sourcefile, err := os.Open(source)
12 if err != nil {
13 return err
14 }
15
16 defer sourcefile.Close()
17
18 destfile, err := os.Create(dest)
19 if err != nil {
20 return err
21 }
22
23 defer destfile.Close()
24
25 _, err = io.Copy(destfile, sourcefile)
26 if err == nil {
27 sourceinfo, err := os.Stat(source)
28 if err != nil {
29 _ = os.Chmod(dest, sourceinfo.Mode())
30 }
31 }
32
33 return
34}
35
36// CopyDir recursive copy of directory
37func CopyDir(source string, dest string) (err error) {

Callers 1

CopyDirFunction · 0.85

Calls 5

ModeMethod · 0.80
OpenMethod · 0.65
CloseMethod · 0.65
CreateMethod · 0.65
CopyMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…