MCPcopy Create free account
hub / github.com/gogs/gogs / Download

Method Download

internal/lfsutil/storage.go:124–141  ·  view source on GitHub ↗
(oid OID, w io.Writer)

Source from the content-addressed store, hash-verified

122}
123
124func (s *LocalStorage) Download(oid OID, w io.Writer) error {
125 fpath := s.storagePath(oid)
126 if !osutil.IsFile(fpath) {
127 return ErrObjectNotExist
128 }
129
130 r, err := os.Open(fpath)
131 if err != nil {
132 return errors.Wrap(err, "open file")
133 }
134 defer r.Close()
135
136 _, err = io.Copy(w, r)
137 if err != nil {
138 return errors.Wrap(err, "copy file")
139 }
140 return nil
141}

Callers 2

TestLocalStorage_UploadFunction · 0.95

Calls 2

storagePathMethod · 0.95
IsFileFunction · 0.92

Tested by 2

TestLocalStorage_UploadFunction · 0.76