MCPcopy
hub / github.com/mxpv/podsync / copyFile

Method copyFile

pkg/fs/local.go:58–72  ·  view source on GitHub ↗
(source io.Reader, destinationPath string)

Source from the content-addressed store, hash-verified

56}
57
58func (l *Local) copyFile(source io.Reader, destinationPath string) (int64, error) {
59 dest, err := os.Create(destinationPath)
60 if err != nil {
61 return 0, errors.Wrap(err, "failed to create destination file")
62 }
63
64 defer dest.Close()
65
66 written, err := io.Copy(dest, source)
67 if err != nil {
68 return 0, errors.Wrap(err, "failed to copy data")
69 }
70
71 return written, nil
72}
73
74func (l *Local) Size(_ctx context.Context, name string) (int64, error) {
75 file, err := l.Open(name)

Callers 2

CreateMethod · 0.95
TestLocal_copyFileFunction · 0.95

Calls 2

CreateMethod · 0.65
CloseMethod · 0.65

Tested by 1

TestLocal_copyFileFunction · 0.76