|
// CopyFile copies the source file to the target. |
|
// The most efficient means of copying is used for the platform. |
|
func CopyFile(target, source string) error { |
|
src, err := os.Open(source) |
|
if err != nil { |
|
return errors.Wrapf(err, "failed to open source %s", source) |
|
} |
|
defer src.Close() |
|
tgt, err := os.Create(target) |
|
if err != nil { |
|
return errors.Wrapf(err, "failed to open target %s", target) |
|
} |
|
defer tgt.Close() |
|
|
|
return copyFileContent(tgt, src) |
|
} |
The current implementation of CopyFile does not support copying metadata.
CopyFile should optionally copy the metadata as in CopyDir
continuity/fs/copy.go
Lines 161 to 176 in 1805252
The current implementation of
CopyFiledoes not support copying metadata.CopyFileshould optionally copy the metadata as inCopyDir