lister.go 479 B

12345678910111213141516171819202122
  1. package sftpd
  2. import (
  3. "io"
  4. "os"
  5. )
  6. type listerAt []os.FileInfo
  7. // ListAt returns the number of entries copied and an io.EOF error if we made it to the end of the file list.
  8. // Take a look at the pkg/sftp godoc for more information about how this function should work.
  9. func (l listerAt) ListAt(f []os.FileInfo, offset int64) (int, error) {
  10. if offset >= int64(len(l)) {
  11. return 0, io.EOF
  12. }
  13. n := copy(f, l[offset:])
  14. if n < len(f) {
  15. return n, io.EOF
  16. }
  17. return n, nil
  18. }