MCPcopy Create free account
hub / github.com/cloudreve/cloudreve / Read

Method Read

application/statics/embed.go:356–366  ·  view source on GitHub ↗
(b []byte)

Source from the content-addressed store, hash-verified

354func (f *openFile) Stat() (fs.FileInfo, error) { return f.f, nil }
355
356func (f *openFile) Read(b []byte) (int, error) {
357 if f.offset >= int64(len(f.f.data)) {
358 return 0, io.EOF
359 }
360 if f.offset < 0 {
361 return 0, &fs.PathError{Op: "read", Path: f.f.name, Err: fs.ErrInvalid}
362 }
363 n := copy(b, f.f.data[f.offset:])
364 f.offset += int64(n)
365 return n, nil
366}
367
368func (f *openFile) Seek(offset int64, whence int) (int64, error) {
369 switch whence {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected