MCPcopy Create free account
hub / github.com/MertJSX/folderhost / CopyFile

Function CopyFile

utils/copy_functions.go:51–70  ·  view source on GitHub ↗
(srcFile, dstFile string)

Source from the content-addressed store, hash-verified

49}
50
51func CopyFile(srcFile, dstFile string) error {
52 out, err := os.Create(dstFile)
53 if err != nil {
54 return err
55 }
56 defer out.Close()
57
58 in, err := os.Open(srcFile)
59 if err != nil {
60 return err
61 }
62 defer in.Close()
63
64 _, err = io.Copy(out, in)
65 if err != nil {
66 return err
67 }
68
69 return nil
70}
71
72func CreateIfNotExists(dir string, perm os.FileMode) error {
73 if IsExistingPath(dir) {

Callers 2

CreateCopyFunction · 0.92
CopyDirectoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected