fs: Add interface and FS implementations

This adds two implementations of the new `FS` interface: One for the local
file system (`Local`) and one for a single file read from an
`io.Reader` (`Reader`).
This commit is contained in:
Alexander Neumann
2018-01-03 21:53:45 +01:00
parent 83ca08245b
commit c4b2486b7c
14 changed files with 994 additions and 14 deletions

View File

@@ -1,25 +1,11 @@
package fs
import (
"io"
"os"
"path/filepath"
"time"
)
// File is an open file on a file system.
type File interface {
io.Reader
io.Writer
io.Closer
Fd() uintptr
Readdirnames(n int) ([]string, error)
Readdir(int) ([]os.FileInfo, error)
Seek(int64, int) (int64, error)
Stat() (os.FileInfo, error)
}
// Mkdir creates a new directory with the specified name and permission bits.
// If there is an error, it will be of type *PathError.
func Mkdir(name string, perm os.FileMode) error {