1package fileserver
2
3import (
4 "go.rbn.im/neinp/stat"
5
6 "io"
7 "os"
8)
9
10type directory struct {
11 stat stat.Stat
12 children []stat.Stat
13}
14
15func (d directory) Read(off int64, p []byte) (int, error) {
16 reader := stat.NewReader(d.children...)
17
18 n, err := reader.Seek(off, io.SeekStart)
19 if err != nil {
20 return int(n), io.EOF
21 }
22
23 return reader.Read(p)
24}
25
26func (d directory) Write(off int64, p []byte) (int, error) {
27 return 0, os.ErrInvalid
28}
29
30func (d directory) Close() error {
31 return nil
32}