MCPcopy
hub / github.com/dreadl0ck/netcap / CopyFile

Function CopyFile

utils/utils.go:47–73  ·  view source on GitHub ↗

CopyFile the source file contents to destination file attributes wont be copied and an existing file will be overwritten.

(src, dst string)

Source from the content-addressed store, hash-verified

45// CopyFile the source file contents to destination
46// file attributes wont be copied and an existing file will be overwritten.
47func CopyFile(src, dst string) {
48 in, err := os.Open(src)
49 if err != nil {
50 log.Fatal(err)
51 }
52
53 defer func() {
54 if errClose := in.Close(); errClose != nil {
55 fmt.Println(errClose)
56 }
57 }()
58
59 out, err := os.Create(dst)
60 if err != nil {
61 log.Fatal(err)
62 }
63
64 _, err = io.Copy(out, in)
65 if err != nil {
66 log.Fatal(err)
67 }
68
69 err = out.Close()
70 if err != nil {
71 log.Fatal(err)
72 }
73}
74
75// Confirm displays a prompt message to the terminal and returns a bool indicating the user decision.
76func Confirm(s string) bool {

Callers 4

TestGenerateAllEntitiesFunction · 0.92
UpdateDBsFunction · 0.92

Calls 1

CloseMethod · 0.65

Tested by 3

TestGenerateAllEntitiesFunction · 0.74